From 44e01ea063e6d1b812ace9c001f7ba4a8ccf4479 Mon Sep 17 00:00:00 2001 From: GithubAnon0000 <160563432+GithubAnon0000@users.noreply.github.com> Date: Sun, 9 Feb 2025 13:06:49 +0000 Subject: [PATCH] Update reviewer.py to prevent custom scheduler js from commenting out py code (#3795) * Update reviewer.py to prevent custom scheduler js from commenting out py code * Do not use custom code, but move {js} instead --- qt/aqt/reviewer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qt/aqt/reviewer.py b/qt/aqt/reviewer.py index 80a9dedd7..1a8682773 100644 --- a/qt/aqt/reviewer.py +++ b/qt/aqt/reviewer.py @@ -1215,7 +1215,11 @@ timerStopped = false; setFlag = set_flag_on_current_card +# if the last element is a comment, then the RUN_STATE_MUTATION code +# breaks due to the comment wrongly commenting out python code. +# To prevent this we put the js code on a separate line RUN_STATE_MUTATION = """ -anki.mutateNextCardStates('{key}', async (states, customData, ctx) => {{ {js} }}) - .finally(() => bridgeCommand('statesMutated')); +anki.mutateNextCardStates('{key}', async (states, customData, ctx) => {{ + {js} + }}).finally(() => bridgeCommand('statesMutated')); """