Skip to content

Commit

Permalink
Fix prices not being written correctly to file
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKobayashi committed Aug 9, 2022
1 parent e23e6c1 commit 32d2257
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# Print the price and location data
print("\nBest " + str(type) + " price: ", price, "\nLocated at: ", str(loc))

# Send alert on price change
# Add alert to content on price change
if price != float(priceDataFile[type]):
if price > float(priceDataFile[type]):
content += ":arrow_up:\t\t"
Expand All @@ -72,6 +72,9 @@
+ "\n\n"
)

# Add price from API to price data file
priceDataFile[type] = price

# Post any price changes to webhook
if content != "":
content += (
Expand All @@ -81,8 +84,6 @@
)
requests.post(webhookURL, data={"content": content})

priceDataFile[type] = price

# Write the current price to the JSON file
with open("data/priceData.json", "w") as file:
json.dump(priceDataFile, file)
Expand Down

0 comments on commit 32d2257

Please sign in to comment.