Visual changes
This commit is contained in:
@@ -64,29 +64,29 @@ pub fn add_stat_list(stat: &mut Vec<CardStatistics>, connection: &Connection) {
|
||||
|
||||
let mut index = 0;
|
||||
for id in start_index..=last_index {
|
||||
stat[index].id = id as u32;
|
||||
stat[index].id = id;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_stat(stat: &mut CardStatistics, connection: &Connection) {
|
||||
let time = Instant::now();
|
||||
let index = connection
|
||||
.query_row(
|
||||
"INSERT INTO card_stats (word_id, set_id, score, last_opened) VALUES (?1, ?2, ?3, ?4) RETURNING id",
|
||||
(
|
||||
&stat.word_id,
|
||||
&stat.set_id,
|
||||
&stat.score,
|
||||
&stat.last_open.timestamp(),
|
||||
),
|
||||
|row| row.get(0)
|
||||
)
|
||||
.unwrap_or_else(|e| {println!("{}", e); 0});
|
||||
|
||||
stat.id = index;
|
||||
println!("Added stat: {}", time.elapsed().as_millis());
|
||||
}
|
||||
// pub fn add_stat(stat: &mut CardStatistics, connection: &Connection) {
|
||||
// let time = Instant::now();
|
||||
// let index = connection
|
||||
// .query_row(
|
||||
// "INSERT INTO card_stats (word_id, set_id, score, last_opened) VALUES (?1, ?2, ?3, ?4) RETURNING id",
|
||||
// (
|
||||
// &stat.word_id,
|
||||
// &stat.set_id,
|
||||
// &stat.score,
|
||||
// &stat.last_open.timestamp(),
|
||||
// ),
|
||||
// |row| row.get(0)
|
||||
// )
|
||||
// .unwrap_or_else(|e| {println!("{}", e); 0});
|
||||
//
|
||||
// stat.id = index;
|
||||
// println!("Added stat: {}", time.elapsed().as_millis());
|
||||
// }
|
||||
|
||||
pub fn update_stat_score(stat: &CardStatistics, connection: &Connection) {
|
||||
let time = Instant::now();
|
||||
|
||||
Reference in New Issue
Block a user