automated commit by check50 [check50=True]

This commit is contained in:
kukemuna 2024-04-26 08:38:56 +03:00
parent b9530e6711
commit 8b9c1adadc
4 changed files with 25 additions and 21 deletions

6
app.py
View File

@ -78,7 +78,11 @@ def buy():
if stock == None:
return apology("Symbol not found")
if shares:
if not shares or shares.isalpha() or not float(shares).is_integer():
return apology("invalid shares")
else:
if float(shares) > 0:
transaction_value = float(shares) * stock["price"]
user_id = session["user_id"]

Binary file not shown.

View File

@ -10,7 +10,7 @@
<input class="form-control mx-auto w-auto" autocomplete="off" autofocus="" name="symbol" placeholder="Symbol" type="text">
</div>
<div class="mb-3">
<input class="form-control mx-auto w-auto" autocomplete="off" autofocus min="1" name="shares" placeholder="Shares" type="number">
<input class="form-control mx-auto w-auto" autocomplete="off" autofocus min="1" name="shares" placeholder="Shares" type="text">
</div>
<button class="btn btn-primary" type="submit">Buy</button>
</form>