Apply suggestions from code review

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
This commit is contained in:
Jarrett Ye 2025-08-04 19:58:22 +08:00 committed by GitHub
parent 0a60d795dc
commit 7ce237efae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -88,19 +88,21 @@ impl RevlogEntry {
/// Returns true if this entry represents a reset operation. /// Returns true if this entry represents a reset operation.
/// These entries are created when a card is reset using /// These entries are created when a card is reset using
/// [`Collection::reschedule_cards_as_new`]. /// [`Collection::reschedule_cards_as_new`].
/// The `ease_factor` should be 0 because /// The 0 value of `ease_factor` differentiates it
/// [`Collection::set_due_date`] also sets created `RevlogEntry` with /// from entry created by [`Collection::set_due_date`] that has
/// `RevlogReviewKind::Manual` but the `ease_factor` is not 0. /// `RevlogReviewKind::Manual` but non-zero `ease_factor`.
pub(crate) fn is_reset(&self) -> bool { pub(crate) fn is_reset(&self) -> bool {
self.review_kind == RevlogReviewKind::Manual && self.ease_factor == 0 self.review_kind == RevlogReviewKind::Manual && self.ease_factor == 0
} }
/// Returns true if this entry represents a cramming operation. /// Returns true if this entry represents a cramming operation.
/// These entries are created when a card is previewed using /// These entries are created when a card is reviewed in a
/// filtered deck with "Reschedule cards based on my answers
/// in this deck" disabled.
/// [`crate::scheduler::answering::CardStateUpdater::apply_preview_state`]. /// [`crate::scheduler::answering::CardStateUpdater::apply_preview_state`].
/// The `ease_factor` should be 0 because /// The 0 value of `ease_factor` distinguishes it from the entry
/// [`crate::scheduler::states::ReviewState::revlog_kind`] returns /// created when a card is reviewed before its due date in a
/// `RevlogReviewKind::Filtered` when `days_late() < 0`. /// filtered deck with reschedule enabled or using Grade Now.
pub(crate) fn is_cramming(&self) -> bool { pub(crate) fn is_cramming(&self) -> bool {
self.review_kind == RevlogReviewKind::Filtered && self.ease_factor == 0 self.review_kind == RevlogReviewKind::Filtered && self.ease_factor == 0
} }