add goal changing to refresh_milestones()
This commit is contained in:
parent
ea1fc6e051
commit
3858a14f1a
|
@ -108,11 +108,18 @@ def refresh_milestones():
|
|||
"SELECT goal FROM milestones WHERE name = ?",
|
||||
(redeem,)
|
||||
)
|
||||
if cursor.fetchone() is None:
|
||||
result = cursor.fetchone()
|
||||
if result is None:
|
||||
cursor.execute(
|
||||
"INSERT INTO milestones(name, progress, goal, complete) VALUES(?, 0, ?, FALSE)",
|
||||
(redeem, redeem_info['goal'])
|
||||
)
|
||||
# update existing milestone to new goal
|
||||
elif result != redeem_info["goal"]:
|
||||
cursor.execute(
|
||||
"UPDATE milestones SET goal = ? WHERE name = ?",
|
||||
(redeem_info["goal"], redeem)
|
||||
)
|
||||
db.commit()
|
||||
except sqlite3.Error as e:
|
||||
print("Failed inserting milestones to db:", e.args[0])
|
||||
|
|
Loading…
Reference in New Issue