Fix deck data
This commit is contained in:
1 parent
9a7578727b
commit
08ab55f283
7 files changed
+145
-96
No files matched your search
@@ -162,29 +162,9 @@ impl RepetitionState {
|
||||
Err(err) => push_error!(err),
|
||||
});
|
||||
}
|
||||
self.increment_counter();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
fn increment_counter(&mut self) {
|
||||
let mut state = self.state;
|
||||
let id = self.settings.id;
|
||||
let activity = state.activity.get_mut(&id);
|
||||
|
||||
let now = Local::now().date_naive();
|
||||
|
||||
if let Some(activity) = activity {
|
||||
let (last_day, counter) = activity.last_mut().unwrap();
|
||||
if *last_day == now {
|
||||
*counter += 1;
|
||||
} else {
|
||||
activity.push((now, 1));
|
||||
}
|
||||
} else {
|
||||
state.activity.insert(id, vec![(now, 1)]);
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_forward(&self) -> Element<'_, RepetitionMessage> {
|
||||
self.draw_card_view(self.settings.forward.as_str())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user