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
+3 -3
View File
@@ -1,4 +1,4 @@
use crate::lang::{DeckSettings, CardStatistics};
use crate::lang::{DeckSettings, CardStatistics, INVALID_ID};
use rusqlite::Connection;
use std::time::Instant;
@@ -62,7 +62,7 @@ pub fn add_stat_list(stat: &mut [CardStatistics], connection: &Connection) {
let start_index = last_index - (stat.len() as u32) + 1;
for (index, id) in (start_index..=last_index).enumerate() {
stat[index].id = id;
stat[index].id = id.into();
}
println!("Added {} cards for {:?}", stat.len(), time.elapsed());
@@ -103,7 +103,7 @@ pub fn update_stat_score(stat: &CardStatistics, connection: &Connection) {
}
pub fn delete_stat(stat: &CardStatistics, connection: &Connection) {
if stat.id == 0 {
if stat.id == INVALID_ID {
return;
}
connection