From c68a3924fcbc8024ae14cbb63caff3a62c393806 Mon Sep 17 00:00:00 2001 From: Lili Date: Mon, 27 Mar 2023 14:19:26 +0200 Subject: [PATCH] simplify refresh_counters --- tlapbot/db.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tlapbot/db.py b/tlapbot/db.py index 7032acd..d9ba327 100644 --- a/tlapbot/db.py +++ b/tlapbot/db.py @@ -68,17 +68,7 @@ def refresh_counters(): db.commit() except sqlite3.Error as e: print("Error occured deleting old counters:", e.args[0]) - - for redeem, redeem_info in current_app.config['REDEEMS'].items(): - if redeem_info["type"] == "counter": - try: - cursor = db.execute( - "INSERT INTO counters(name, count) VALUES(?, 0)", - (redeem,) - ) - db.commit() - except sqlite3.Error as e: - print("Failed inserting counters to db:", e.args[0]) + insert_counters(db) def refresh_milestones():