def setup(): session["email"] = session.get("email") session["name"] = session.get("name") session["password"] = session.get("password") db.setup() # work = BackgroundScheduler(check_alert, "cron", day_of_week="0-4", hour="16", miniute="30") work = BackgroundScheduler() # work.add_job(check_alert, "interval", seconds=10) work.add_job(get_reminder, "interval", seconds=10000000) # work.add_job(check_alert, "cron", day_of_week="0-4", hour="18",minute="1") work.start()
def rank(): Database.setup() gamer_count = Database.get_all(document="game").count() sort_amount = {} for index in range(0, gamer_count): temp_name = Database.get_all(document="game")[index]["name"] Gamer.update_amount(temp_name) for index in range(0, gamer_count): sort_amount[Database.get_all( document="game")[index]["name"]] = Database.get_all( document="game")[index]["amount"] # print(sort) sorted_amount = sorted(sort_amount.items(), key=lambda kv: kv[1], reverse=True) print(sort_amount) print(sorted_amount) return sorted_amount
from backends.database import Database Database.setup() print(Database.match(document="test", new_record={"name": "dolly"})) print(Database.find(document="test", new_record={"age": "3"})) print(Database.get_all(document="test")) print(Database.get_all(document="test")[0]['name']) print(Database.get_all(document="test")[1])