forked from bton/matekasse
float to int
This commit is contained in:
parent
701d9c2f1e
commit
1a51402170
1 changed files with 2 additions and 2 deletions
|
@ -141,14 +141,14 @@ def create_app(test_config=None):
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
try:
|
try:
|
||||||
user_id = request.form["id"]
|
user_id = request.form["id"]
|
||||||
change = float(request.form["change"])
|
change = int(request.form["change"] * 100)
|
||||||
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])
|
||||||
users = c.fetchall()
|
users = c.fetchall()
|
||||||
if users != []:
|
if users != []:
|
||||||
balance_old = users[0][2]
|
balance_old = users[0][2]
|
||||||
c.execute(f"UPDATE users SET balance = balance + {change*100} WHERE id={user_id}")
|
c.execute(f"UPDATE users SET balance = balance + {change} WHERE id={user_id}")
|
||||||
db.commit()
|
db.commit()
|
||||||
c.execute(f"SELECT * FROM users WHERE id={user_id}")
|
c.execute(f"SELECT * FROM users WHERE id={user_id}")
|
||||||
user = c.fetchone()
|
user = c.fetchone()
|
||||||
|
|
Loading…
Reference in a new issue