fd
This commit is contained in:
parent
48b6d9fe38
commit
cc0e11e5b0
2 changed files with 4 additions and 0 deletions
|
@ -63,6 +63,7 @@ def shop(v):
|
||||||
def buy(v, award):
|
def buy(v, award):
|
||||||
if award not in AWARDS: abort(400)
|
if award not in AWARDS: abort(400)
|
||||||
price = AWARDS[award]["price"]
|
price = AWARDS[award]["price"]
|
||||||
|
print(price)
|
||||||
if v.coins < price: return render_template("shop.html", v=v, error="You don't have enough coins to buy this item.")
|
if v.coins < price: return render_template("shop.html", v=v, error="You don't have enough coins to buy this item.")
|
||||||
v.coins -= price
|
v.coins -= price
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
@ -70,6 +71,8 @@ def buy(v, award):
|
||||||
award = AwardRelationship(user_id=v.id, kind=award)
|
award = AwardRelationship(user_id=v.id, kind=award)
|
||||||
g.db.add(award)
|
g.db.add(award)
|
||||||
|
|
||||||
|
print(award)
|
||||||
|
|
||||||
return render_template("shop.html", awards=list(AWARDS.values()), v=v)
|
return render_template("shop.html", awards=list(AWARDS.values()), v=v)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
<th scope="col">Icon</th>
|
<th scope="col">Icon</th>
|
||||||
<th scope="col">Title</th>
|
<th scope="col">Title</th>
|
||||||
<th scope="col">Price</th>
|
<th scope="col">Price</th>
|
||||||
|
<th scope="col">Buy</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue