forked from bton/matekasse
1 Credit = 1 Euro
This commit is contained in:
parent
abb5675161
commit
b3f919fe65
1 changed files with 4 additions and 5 deletions
|
@ -76,7 +76,7 @@ def create_app(test_config=None):
|
||||||
users = c.fetchall()
|
users = c.fetchall()
|
||||||
text = ""
|
text = ""
|
||||||
for i in users:
|
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>
|
return '''<!DOCTYPE html>
|
||||||
<html lang="en">
|
<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>
|
<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>
|
</script>
|
||||||
<title>Strichliste</title>
|
<title>Strichliste</title>
|
||||||
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
|
<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="/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>
|
<form action="/adduser" method="get"><button type="submit">Add User</button></form>
|
||||||
<br></br>
|
<br></br>
|
||||||
|
@ -120,7 +119,7 @@ def create_app(test_config=None):
|
||||||
<p> {escape(user[1])} : {user[2]} <p>
|
<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="/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>
|
<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>
|
</p>
|
||||||
<br></br>
|
<br></br>
|
||||||
<p>Tags:</p>
|
<p>Tags:</p>
|
||||||
|
@ -188,7 +187,7 @@ def create_app(test_config=None):
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
try:
|
try:
|
||||||
user_id = request.args.get("id")
|
user_id = request.args.get("id")
|
||||||
change = int(request.args.get("change"))
|
change = float(request.args.get("change"))
|
||||||
except:
|
except:
|
||||||
return render_template("error.html", error_code="095")
|
return render_template("error.html", error_code="095")
|
||||||
c.execute(f"SELECT * FROM users WHERE id=?", [user_id])
|
c.execute(f"SELECT * FROM users WHERE id=?", [user_id])
|
||||||
|
@ -367,7 +366,7 @@ def create_app(test_config=None):
|
||||||
if user_list != []:
|
if user_list != []:
|
||||||
balance_old = user_list[0][2]
|
balance_old = user_list[0][2]
|
||||||
if user_queue.qsize() == 0:
|
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()
|
db.commit()
|
||||||
c.execute(f"SELECT * FROM users WHERE id={tag[1]}")
|
c.execute(f"SELECT * FROM users WHERE id={tag[1]}")
|
||||||
user = c.fetchone()
|
user = c.fetchone()
|
||||||
|
|
Loading…
Reference in a new issue