Fix: Could answer same card twice if fast enough

This commit is contained in:
Luc Mcgrady 2025-11-30 18:44:01 +00:00
parent 71012e7e28
commit c6a1e1d16c
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C

View file

@ -70,6 +70,7 @@ export class ReviewerState {
undoStatus: UndoStatus | undefined = undefined;
autoAdvanceQuestionTimeout: ReturnType<typeof setTimeout> | undefined;
autoAdvanceAnswerTimeout: ReturnType<typeof setTimeout> | undefined;
_answerShown = false;
iframe: HTMLIFrameElement | undefined = undefined;
@ -414,6 +415,7 @@ export class ReviewerState {
this.setUndo(tr.actionsAnswerCard());
}
this._answerShown = false;
const resp = await nextCardData({
answer: answer || undefined,
});
@ -461,16 +463,13 @@ export class ReviewerState {
public async showAnswer() {
this.answerShown.set(true);
this._answerShown = true;
this.maybeAutoPlayAudio(this._cardData!.answerAvTags);
this.answerMs = Date.now();
this.updateHtml(await this.showTypedAnswer(this._cardData?.back || ""));
this.updateAutoAdvanceAnswer();
}
get _answerShown() {
return get(this.answerShown);
}
public easeButtonPressed(rating: number) {
if (!this._answerShown) {
return;