Sync solved

This commit is contained in:
micialware committed 2026-09-06 23:55:50 +03:00
1 parent 22c05250aa
commit 1afb7493f6
9 files changed
+164 -158

No files matched your search

+6 -6
View File
@@ -15,7 +15,7 @@ pub type CardStateRepositoryInner = DataRepositoryInner<CardState, SqliteDbLayer
pub struct CardStatesQuerySet;
impl TableAccessQuerySet<CardState> for CardStatesQuerySet {
fn load() -> &'static str {
"SELECT id, word_id, set_id, score, last_opened, fsrs_opened, fsrs_memory, fsrs_open_day FROM states"
"SELECT id, word_id, deck_id, score, last_opened, fsrs_opened, fsrs_memory, fsrs_open_day FROM states"
}
fn save() -> &'static str {
@@ -23,7 +23,7 @@ impl TableAccessQuerySet<CardState> for CardStatesQuerySet {
}
fn add() -> &'static str {
"INSERT INTO states (word_id, set_id, score, last_opened, fsrs_opened, fsrs_memory, fsrs_open_day) VALUES (?1, ?2, ?3, ?4)"
"INSERT INTO states (word_id, deck_id, score, last_opened, fsrs_opened, fsrs_memory, fsrs_open_day) VALUES (?1, ?2, ?3, ?4)"
}
fn name() -> &'static str {
@@ -34,7 +34,7 @@ impl TableAccessQuerySet<CardState> for CardStatesQuerySet {
Ok(CardState {
id: row.get(0)?,
word_id: row.get(1)?,
set_id: row.get(2)?,
deck_id: row.get(2)?,
score: row.get(3)?,
fsrs_opened: NaiveDate::from_epoch_days(row.get::<usize, i32>(5)?)
.expect("Incorrect date encoding"),
@@ -48,7 +48,7 @@ impl TableAccessQuerySet<CardState> for CardStatesQuerySet {
fn insert_params(entity: &CardState) -> impl Params {
(
entity.word_id,
entity.set_id,
entity.deck_id,
entity.score,
entity.last_open.timestamp(),
entity.fsrs_opened.to_epoch_days(),
@@ -73,7 +73,7 @@ pub fn load_stats_of_deck(
Ok(CardState {
id: row.get(0)?,
word_id: row.get(1)?,
set_id: set.id,
deck_id: set.id,
score: row.get(2)?,
fsrs_opened: NaiveDate::from_epoch_days(row.get::<usize, i32>(4)?)
.expect("Incorrect date encoding"),
@@ -126,7 +126,7 @@ pub fn add_stat_list(stats: &mut [CardState], connection: &mut Connection) -> Ma
for stat in stats.iter() {
stmt.execute(params![
stat.word_id,
stat.set_id,
stat.deck_id,
stat.score,
stat.last_open.timestamp(),
stat.fsrs_opened.to_epoch_days(),