From 0d51b4db1ff3de1ce2ebfee4b9e215db24329e84 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 14 Dec 2021 15:48:02 +1000 Subject: [PATCH] ensure multiple answer buttons don't get accepted when mashed in v3 We want to preserve the backend checks, because they may also detect bugs. So we do the debouncing on the frontend instead, transitioning into a temporary state until the background op completes. https://forums.ankiweb.net/t/anki-2-1-50-beta/15608/74 --- qt/aqt/reviewer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qt/aqt/reviewer.py b/qt/aqt/reviewer.py index 057973047..e81e726e5 100644 --- a/qt/aqt/reviewer.py +++ b/qt/aqt/reviewer.py @@ -121,7 +121,7 @@ class Reviewer: self._answeredIds: list[CardId] = [] self._recordedAudio: str | None = None self.typeCorrect: str = None # web init happens before this is set - self.state: str | None = None + self.state: Literal["question", "answer", "transition", None] = None self._refresh_needed: RefreshNeeded | None = None self._v3: V3CardInfo | None = None self._state_mutation_key = str(random.randint(0, 2 ** 64 - 1)) @@ -420,6 +420,7 @@ class Reviewer: if sched.state_is_leech(answer.new_state): self.onLeech() + self.state = "transition" answer_card(parent=self.mw, answer=answer).success( after_answer ).run_in_background(initiator=self)