Create fsrs upadte method

This commit is contained in:
micialware committed 2026-08-28 18:52:38 +03:00
1 parent 663fa377b1
commit e7019903b0
5 files changed
+73 -10

No files matched your search

+9 -1
View File
@@ -7,7 +7,7 @@ use crate::data::entities::*;
use crate::data_provider::card_stats::{load_stats_of_deck, update_stat_score};
use crate::data_provider::history::push_note;
use crate::notification::{MaybeError, NotificationData};
use chrono::Utc;
use chrono::{Local, Utc};
use parking_lot::Mutex;
use std::sync::Arc;
@@ -16,6 +16,7 @@ pub struct DeckData {
pub(crate) words: Vec<WordData>,
pub(crate) set: Vec<CardStatistics>,
current_word_index: Option<usize>,
fsrs_indices: Vec<usize>,
state: Arc<Mutex<AppState>>,
order_module: OrderModule,
settings: DeckSettings,
@@ -41,7 +42,14 @@ impl DeckData {
.cloned()
.collect();
let today = Local::now().to_utc().date_naive();
Ok(Self {
fsrs_indices: stats
.iter()
.enumerate()
.filter(|(_, c)| c.fsrs_open_day == today)
.map(|(i, _)| i)
.collect(),
set: stats,
words,
current_word_index: None,