mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -05:00
use QueuedCards
This commit is contained in:
parent
8bf232ed79
commit
f49d7d5fd7
3 changed files with 9 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue