Skip to content

Commit

Permalink
Minor change on prices and objects
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-royer committed Feb 15, 2022
1 parent 0807a9c commit 7fe4047
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions BDD/compute_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ def compute():
database = c.execute("SELECT * FROM objets").fetchall()

for obj in database:
if obj[0] == -1:
price = 0
# si l'objet n'est rattaché à aucun magasin
if obj[0] == -1: price = 0

# sinon
else:
price = get_price(obj[3: -2])
if price == 0: price = 1
elif price < 0: price = abs(price)

if obj[1] != 6:
# si l'objet n'est ni un moyen de transport, ni un outil, on met à jour
if not obj[1] in (6, 7):
c.execute(f"""
UPDATE objets SET argent = {price}
WHERE nom = \"{obj[2]}\"
Expand Down
Binary file modified BDD/odyssee_objects.db
Binary file not shown.

0 comments on commit 7fe4047

Please sign in to comment.