1 Credit = 1 Euro

This commit is contained in:
2000-Trek 2023-10-13 16:26:10 +02:00
parent abb5675161
commit b3f919fe65

View file

@ -76,7 +76,7 @@ def create_app(test_config=None):
users = c.fetchall()
text = ""
for i in users:
text = text + f'<p><a href="list/user?id={i[0]}">{escape(i[1])}</a>: {i[2]} <form action="/change" method="get"><input name="id" type="hidden" value="{i[0]}"> <input name="change" type="number" placeholder="change balance"></form></p> <br style="line-height: 50%;"></br>'
text = text + f'<p><a href="list/user?id={i[0]}">{escape(i[1])}</a>: {i[2]} <form action="/change" method="get"><input name="id" type="hidden" value="{i[0]}"> <input name="change" type="number" step="0.1" placeholder="change balance"></form></p> <br style="line-height: 50%;"></br>'
return '''<!DOCTYPE html>
<html lang="en">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
@ -88,7 +88,6 @@ def create_app(test_config=None):
</script>
<title>Strichliste</title>
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
<p>1 Credit = 1,50 Euro</p>
<form action="/list/user" method="get"><input name="user" type="search" placeholder="Search for user"><button>Search</button></form>
<form action="/adduser" method="get"><button type="submit">Add User</button></form>
<br></br>
@ -120,7 +119,7 @@ def create_app(test_config=None):
<p> {escape(user[1])} : {user[2]} <p>
<form action="/addtag" method="get"><input name="id" type="hidden" value="{user[0]}"><button type="submit">Add Tag</button></form>
<form action="/removetag" method="get"><input name="id" type="hidden" value="{user[0]}"><button type="submit">Remove Tag</button></form>
</p><form action="/change" method="get"><input name="id" type="hidden" value="{user[0]}"> <input name="change" type="number" placeholder="change balance"></form>
</p><form action="/change" method="get"><input name="id" type="hidden" value="{user[0]}"> <input name="change" type="number" step="0.1" placeholder="change balance"></form>
</p>
<br></br>
<p>Tags:</p>
@ -188,7 +187,7 @@ def create_app(test_config=None):
c = db.cursor()
try:
user_id = request.args.get("id")
change = int(request.args.get("change"))
change = float(request.args.get("change"))
except:
return render_template("error.html", error_code="095")
c.execute(f"SELECT * FROM users WHERE id=?", [user_id])
@ -367,7 +366,7 @@ def create_app(test_config=None):
if user_list != []:
balance_old = user_list[0][2]
if user_queue.qsize() == 0:
c.execute(f"UPDATE users SET balance = balance - 1 WHERE id={tag[1]}")
c.execute(f"UPDATE users SET balance = balance - 1.5 WHERE id={tag[1]}")
db.commit()
c.execute(f"SELECT * FROM users WHERE id={tag[1]}")
user = c.fetchone()