From 1f95d030bbc7ebcc004ffe1e2be2a320c9fe1e94 Mon Sep 17 00:00:00 2001 From: Yaoliang Chen Date: Sat, 3 May 2025 17:21:48 +0800 Subject: [PATCH] feat(scheduler): add from_queue flag to CardAnswer (#3976) Co-authored-by: Yaoliang --- CONTRIBUTORS | 1 + proto/anki/scheduler.proto | 1 + rslib/src/scheduler/reviews.rs | 4 ++-- rslib/src/scheduler/service/answering.rs | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ae6817aea..491492b00 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -225,6 +225,7 @@ babofitos Jonathan Schoreels JL710 Matt Brubeck +Yaoliang Chen ******************** diff --git a/proto/anki/scheduler.proto b/proto/anki/scheduler.proto index 364bf50ad..0675465ef 100644 --- a/proto/anki/scheduler.proto +++ b/proto/anki/scheduler.proto @@ -279,6 +279,7 @@ message CardAnswer { Rating rating = 4; int64 answered_at_millis = 5; uint32 milliseconds_taken = 6; + optional bool from_queue = 7; } message CustomStudyRequest { diff --git a/rslib/src/scheduler/reviews.rs b/rslib/src/scheduler/reviews.rs index 983ecc452..79bbafb9e 100644 --- a/rslib/src/scheduler/reviews.rs +++ b/rslib/src/scheduler/reviews.rs @@ -163,10 +163,10 @@ impl Collection { rating, milliseconds_taken: 0, answered_at_millis: TimestampMillis::now().into(), + // Process the card without updating queues yet + from_queue: Some(false), } .into(); - // Process the card without updating queues yet - answer.from_queue = false; col.answer_card_inner(&mut answer)?; } Ok(()) diff --git a/rslib/src/scheduler/service/answering.rs b/rslib/src/scheduler/service/answering.rs index 778cf49a1..d858e894e 100644 --- a/rslib/src/scheduler/service/answering.rs +++ b/rslib/src/scheduler/service/answering.rs @@ -21,7 +21,7 @@ impl From for CardAnswer { answered_at: TimestampMillis(answer.answered_at_millis), milliseconds_taken: answer.milliseconds_taken, custom_data, - from_queue: true, + from_queue: answer.from_queue.unwrap_or(true), } } }