From f49d7d5fd71d21e9ba516c249daf93a94cbeed6c Mon Sep 17 00:00:00 2001 From: Luc Mcgrady Date: Sat, 4 Oct 2025 22:52:47 +0100 Subject: [PATCH] use QueuedCards --- proto/anki/scheduler.proto | 6 ++---- rslib/src/scheduler/service/mod.rs | 3 +-- ts/routes/reviewer/reviewer.ts | 8 ++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/proto/anki/scheduler.proto b/proto/anki/scheduler.proto index c6fe8f25b..4debbbf5a 100644 --- a/proto/anki/scheduler.proto +++ b/proto/anki/scheduler.proto @@ -297,12 +297,10 @@ message NextCardDataResponse { } message NextCardData { - int64 card_id = 1; + QueuedCards queue = 1; string front = 2; string back = 3; - - SchedulingStates states = 4; - repeated AnswerButton answer_buttons = 5; + repeated AnswerButton answer_buttons = 4; } optional NextCardData next_card = 1; diff --git a/rslib/src/scheduler/service/mod.rs b/rslib/src/scheduler/service/mod.rs index 3c08835e6..160ff8ba4 100644 --- a/rslib/src/scheduler/service/mod.rs +++ b/rslib/src/scheduler/service/mod.rs @@ -411,11 +411,10 @@ impl crate::services::SchedulerService for Collection { Ok(NextCardDataResponse { next_card: Some(NextCardData { - card_id: cid.0, + queue: Some(queue.into()), front: [style.clone(), render.question().to_string()].concat(), back: [style, render.answer().to_string()].concat(), - states: Some(next_card.states.clone().into()), answer_buttons, }), }) diff --git a/ts/routes/reviewer/reviewer.ts b/ts/routes/reviewer/reviewer.ts index 3bff32715..f71f30347 100644 --- a/ts/routes/reviewer/reviewer.ts +++ b/ts/routes/reviewer/reviewer.ts @@ -45,13 +45,17 @@ export class ReviewerState { this.beginAnsweringMs = Date.now(); } + get currentCard() { + return this.cardData?.queue?.cards[0]; + } + public showAnswer() { this.answerShown.set(true); this.updateHtml(this.cardData?.back || ""); } public easeButtonPressed(rating: number) { - const states = this.cardData!.states!; + const states = this.currentCard!.states!; const newState = [ states.again!, @@ -65,7 +69,7 @@ export class ReviewerState { rating: rating, currentState: states!.current!, newState, - cardId: this.cardData!.cardId, + cardId: this.currentCard?.card?.id, answeredAtMillis: BigInt(Date.now()), millisecondsTaken: Date.now() - this.beginAnsweringMs, }),