diff --git a/pronote_watchdog.py b/pronote_watchdog.py index 010b58e..2ec2fd2 100644 --- a/pronote_watchdog.py +++ b/pronote_watchdog.py @@ -80,7 +80,7 @@ def sync_pronote_plannings(): app = create_app() with app.app_context(): - gmao_context = GmaoContext.get_for_user(2) # TODO: rendre configurable + gmao_context = GmaoContext.query.filter_by(pronote_sync_enabled=True).first() weeks = gmao_context.pronote_sync_weeks if gmao_context else 4 # Récupérer le client PRONOTE @@ -210,7 +210,7 @@ def run_watchdog(): app = create_app() with app.app_context(): # Récupérer le contexte GMAO - gmao_context = GmaoContext.get_for_user(2) # TODO: rendre configurable + gmao_context = GmaoContext.query.filter_by(pronote_sync_enabled=True).first() # Vérifier si activé if not gmao_context or not gmao_context.pronote_sync_enabled: @@ -270,6 +270,7 @@ def main(): signal.signal(signal.SIGINT, signal_handler) while running: + result = None try: result = run_watchdog() if result is False: @@ -292,4 +293,4 @@ def main(): log("Watchdog PRONOTE arrêté") if __name__ == '__main__': - main() \ No newline at end of file + main()