Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.

Commit de2ba7c

Browse files
author
Rico
committed
TASK: Use own method to get data from redis
1 parent 7796e32 commit de2ba7c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

heroku/web.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ def catch():
7777
if data['is_load']:
7878
# If you put money onto your account, save the amount of money as peak
7979
r.set("peak", int(data['amount']))
80-
r.set("balance", int(r.get("balance")) + int(data['amount']))
80+
r.set("balance", int(getRedisValue("balance")) + int(data['amount']))
8181
else:
8282
# If money is withdrawn OR in case of refunds or chargebacks the peak won't be set
83-
r.set("balance", int(r.get("balance")) + int(data['amount']))
83+
r.set("balance", int(getRedisValue("balance")) + int(data['amount']))
8484

85-
if int(data['amount']) > int(r.get("peak")):
85+
if int(data['amount']) > int(getRedisValue("peak")):
8686
# Only if the current balance is greater than the saved peak, save it as peak
8787
r.set("peak", int(data['amount']))
8888
else:
89-
r.set("balance", int(r.get("balance")) + int(data['amount']))
89+
r.set("balance", int(getRedisValue("balance")) + int(data['amount']))
9090
r.set("peak", max_bal)
9191

9292
notify_particle()
@@ -102,8 +102,8 @@ def refresh():
102102

103103
def notify_particle():
104104
# The particle device gets notified about changes here
105-
peak_v = float(r.get("peak"))
106-
balance_v = float(r.get("balance"))
105+
peak_v = float(getRedisValue("peak"))
106+
balance_v = float(getRedisValue("balance"))
107107

108108
# If the balance exceeds the peak/below 0, then the servo/needle might break.
109109
# Because of this, the angle's value gets checked before sending to particle.io

0 commit comments

Comments
 (0)