Migrate to Id type

This commit is contained in:
2026-08-18 12:47:06 +03:00
parent 99b3818181
commit 97c76350e1
12 changed files with 106 additions and 62 deletions
+4 -3
View File
@@ -31,6 +31,7 @@ use hashbrown::HashMap;
use std::sync::{Arc, Mutex};
use std::time::Instant;
use rusqlite::Connection;
use crate::lang::Id;
impl Default for ScreenState {
fn default() -> Self {
@@ -60,7 +61,7 @@ pub enum RootMessage {
RepetitionSettings(RepetitionSettingsMessage),
Import(ImportMessage),
Keyboard(Event),
DataLoaded(HashMap<u32, Vec<(NaiveDate, u32)>>),
DataLoaded(HashMap<Id, Vec<(NaiveDate, u32)>>),
None,
UpdateData,
}
@@ -126,9 +127,9 @@ impl ScreenState {
for file in directory.read_dir().unwrap().flatten() {
let mut vec = vec![];
let history_file_name = file.file_name().into_string().unwrap();
let id = history_file_name[4..history_file_name.len() - 12]
let id : Id = history_file_name[4..history_file_name.len() - 12]
.parse::<u32>()
.unwrap();
.unwrap().into();
let history = get_history_of_set(id);
let by_date = history.chunk_by(|x, x1| {