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 {
|
message NextCardData {
|
||||||
int64 card_id = 1;
|
QueuedCards queue = 1;
|
||||||
string front = 2;
|
string front = 2;
|
||||||
string back = 3;
|
string back = 3;
|
||||||
|
repeated AnswerButton answer_buttons = 4;
|
||||||
SchedulingStates states = 4;
|
|
||||||
repeated AnswerButton answer_buttons = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
optional NextCardData next_card = 1;
|
optional NextCardData next_card = 1;
|
||||||
|
|
|
||||||
|
|
@ -411,11 +411,10 @@ impl crate::services::SchedulerService for Collection {
|
||||||
|
|
||||||
Ok(NextCardDataResponse {
|
Ok(NextCardDataResponse {
|
||||||
next_card: Some(NextCardData {
|
next_card: Some(NextCardData {
|
||||||
card_id: cid.0,
|
queue: Some(queue.into()),
|
||||||
front: [style.clone(), render.question().to_string()].concat(),
|
front: [style.clone(), render.question().to_string()].concat(),
|
||||||
back: [style, render.answer().to_string()].concat(),
|
back: [style, render.answer().to_string()].concat(),
|
||||||
|
|
||||||
states: Some(next_card.states.clone().into()),
|
|
||||||
answer_buttons,
|
answer_buttons,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,17 @@ export class ReviewerState {
|
||||||
this.beginAnsweringMs = Date.now();
|
this.beginAnsweringMs = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get currentCard() {
|
||||||
|
return this.cardData?.queue?.cards[0];
|
||||||
|
}
|
||||||
|
|
||||||
public showAnswer() {
|
public showAnswer() {
|
||||||
this.answerShown.set(true);
|
this.answerShown.set(true);
|
||||||
this.updateHtml(this.cardData?.back || "");
|
this.updateHtml(this.cardData?.back || "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public easeButtonPressed(rating: number) {
|
public easeButtonPressed(rating: number) {
|
||||||
const states = this.cardData!.states!;
|
const states = this.currentCard!.states!;
|
||||||
|
|
||||||
const newState = [
|
const newState = [
|
||||||
states.again!,
|
states.again!,
|
||||||
|
|
@ -65,7 +69,7 @@ export class ReviewerState {
|
||||||
rating: rating,
|
rating: rating,
|
||||||
currentState: states!.current!,
|
currentState: states!.current!,
|
||||||
newState,
|
newState,
|
||||||
cardId: this.cardData!.cardId,
|
cardId: this.currentCard?.card?.id,
|
||||||
answeredAtMillis: BigInt(Date.now()),
|
answeredAtMillis: BigInt(Date.now()),
|
||||||
millisecondsTaken: Date.now() - this.beginAnsweringMs,
|
millisecondsTaken: Date.now() - this.beginAnsweringMs,
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue