Migrate to Id type
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user