-1.5€ Button und preis var
This commit is contained in:
parent
64580f02cb
commit
fd5fd4d78c
1 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@ from markupsafe import escape
|
||||||
from .db import get_db
|
from .db import get_db
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
finished = None
|
finished = None
|
||||||
|
preis = 1.5 #Ein Getraenk
|
||||||
#flask_config
|
#flask_config
|
||||||
DATABASE = './Website/mate.db'
|
DATABASE = './Website/mate.db'
|
||||||
|
|
||||||
|
@ -83,7 +83,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'<form action="/change" method="post"><p style="display: inline;"><a href="list/user?id={i[0]}">{escape(i[1])}</a>: {i[2]/100}€</p><input name="id" type="hidden" value="{i[0]}"> <input name="change" type="number" step="0.01" placeholder="add to balance"></form><br style="line-height: 50%;"></br>'
|
text = text + f'<form action="/change" method="post" style="display: inline;"><p style="display: inline;"><a href="list/user?id={i[0]}">{escape(i[1])}</a>: {i[2]/100}€</p><input name="id" type="hidden" value="{i[0]}"> <input name="change" type="number" step="0.01" placeholder="add to balance"></form><form action="/change" method="post" style="display: inline"><input name="id" type="hidden" value="{i[0]}"><button type="submit" name="change" value=-{preis}>-{preis}€</button></form><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>
|
||||||
|
@ -350,7 +350,7 @@ def create_app(test_config=None):
|
||||||
return make_response(json.dumps({"mode":"error","error":"043"}))
|
return make_response(json.dumps({"mode":"error","error":"043"}))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/api/tag_id", methods=['GET', 'POST'])
|
@app.route("/api/tag_id", methods=['POST'])
|
||||||
def get_id():
|
def get_id():
|
||||||
global finished
|
global finished
|
||||||
global message
|
global message
|
||||||
|
@ -410,7 +410,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 - 150 WHERE id={tag[1]}")
|
c.execute(f"UPDATE users SET balance = balance - {preis*100} 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