automated commit by check50 [check50=True]

This commit is contained in:
kukemuna 2024-04-25 23:41:15 +03:00
parent af74bf282d
commit 6e3bc7d7aa
3 changed files with 17 additions and 16 deletions

11
app.py
View File

@ -68,7 +68,7 @@ def buy():
return render_template("buy.html") return render_template("buy.html")
else: else:
symbol = request.form.get("symbol") symbol = request.form.get("symbol")
shares = int(request.form.get("shares")) shares = request.form.get("shares")
if not symbol: if not symbol:
return apology("Not Symbol") return apology("Not Symbol")
@ -78,7 +78,8 @@ def buy():
if stock == None: if stock == None:
return apology("Symbol not found") return apology("Symbol not found")
transaction_value = shares * stock["price"] if not shares == "":
transaction_value = int(shares) * stock["price"]
user_id = session["user_id"] user_id = session["user_id"]
user_cash_db = db.execute("SELECT cash FROM users WHERE id = ?", user_id) user_cash_db = db.execute("SELECT cash FROM users WHERE id = ?", user_id)
@ -191,15 +192,15 @@ def register():
if request.method == "POST": if request.method == "POST":
# Ensure username was submitted # Ensure username was submitted
if not request.form.get("username"): if not request.form.get("username"):
return apology("must provide username", 403) return apology("must provide username", 400)
# Ensure password was submitted # Ensure password was submitted
elif not request.form.get("password"): elif not request.form.get("password"):
return apology("must provide password", 403) return apology("must provide password", 400)
# Ensure password repeat matches # Ensure password repeat matches
if not request.form.get("password") == request.form.get("confirmation"): if not request.form.get("password") == request.form.get("confirmation"):
return apology("passwords don't match", 403) return apology("passwords don't match", 400)
username = request.form.get("username") username = request.form.get("username")
password = request.form.get("password") password = request.form.get("password")

Binary file not shown.