Fix CardStates
This commit is contained in:
1 parent
068b9c7197
commit
c9ccacc2d1
2 files changed
+9
-9
No files matched your search
@@ -11,7 +11,7 @@ use std::time::Instant;
|
||||
pub struct CardStatesQuerySet;
|
||||
impl TableAccessQuerySet<CardState> for CardStatesQuerySet {
|
||||
fn load() -> &'static str {
|
||||
"INSERT INTO states (word_id, set_id, score, last_opened, fsrs_opened, fsrs_memory, fsrs_open_day) VALUES (?1, ?2, ?3, ?4)"
|
||||
"SELECT id, word_id, set_id, score, last_opened, fsrs_opened, fsrs_memory, fsrs_open_day FROM states"
|
||||
}
|
||||
|
||||
fn save() -> &'static str {
|
||||
@@ -19,7 +19,7 @@ impl TableAccessQuerySet<CardState> for CardStatesQuerySet {
|
||||
}
|
||||
|
||||
fn add() -> &'static str {
|
||||
todo!()
|
||||
"INSERT INTO states (word_id, set_id, score, last_opened, fsrs_opened, fsrs_memory, fsrs_open_day) VALUES (?1, ?2, ?3, ?4)"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
@@ -30,13 +30,13 @@ impl TableAccessQuerySet<CardState> for CardStatesQuerySet {
|
||||
Ok(CardState {
|
||||
id: row.get(0)?,
|
||||
word_id: row.get(1)?,
|
||||
set_id: set.id,
|
||||
score: row.get(2)?,
|
||||
fsrs_opened: NaiveDate::from_epoch_days(row.get::<usize, i32>(4)?)
|
||||
set_id: row.get(2)?,
|
||||
score: row.get(3)?,
|
||||
fsrs_opened: NaiveDate::from_epoch_days(row.get::<usize, i32>(5)?)
|
||||
.expect("Incorrect date encoding"),
|
||||
fsrs_memory: get_memory(row.get(5)?),
|
||||
last_open: row.get(3)?,
|
||||
fsrs_open_day: NaiveDate::from_epoch_days(row.get::<usize, i32>(6)?)
|
||||
fsrs_memory: get_memory(row.get(6)?),
|
||||
last_open: row.get(4)?,
|
||||
fsrs_open_day: NaiveDate::from_epoch_days(row.get::<usize, i32>(7)?)
|
||||
.expect("Incorrect date encoding"),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user