Run cargo and clippy fix
This commit is contained in:
parent
7b931fb033
commit
7cce6409b7
@ -13,13 +13,13 @@ pub async fn load_and_validate_sheets(
|
|||||||
database: &Database,
|
database: &Database,
|
||||||
directory: impl AsRef<Path>,
|
directory: impl AsRef<Path>,
|
||||||
) -> Vec<Sheet> {
|
) -> Vec<Sheet> {
|
||||||
let sheets = sheet_dao::fetch_all_sheets(&database).await.unwrap();
|
let sheets = sheet_dao::fetch_all_sheets(database).await.unwrap();
|
||||||
|
|
||||||
debug!("Validating sheets from database...");
|
debug!("Validating sheets from database...");
|
||||||
let mut validation_result = validate_sheet_files(sheets, directory);
|
let mut validation_result = validate_sheet_files(sheets, directory);
|
||||||
debug!("{}", validation_result.get_stats()); // TODO: handle invalidated files
|
debug!("{}", validation_result.get_stats()); // TODO: handle invalidated files
|
||||||
for updated in validation_result.updated_sheets.iter() {
|
for updated in validation_result.updated_sheets.iter() {
|
||||||
sheet_dao::update_sheet_path(&database, updated)
|
sheet_dao::update_sheet_path(database, updated)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ pub async fn load_and_validate_sheets(
|
|||||||
|
|
||||||
debug!("Inserting unassigned files into orphan table...");
|
debug!("Inserting unassigned files into orphan table...");
|
||||||
for unassigned in validation_result.unassigned_files {
|
for unassigned in validation_result.unassigned_files {
|
||||||
let orphan = sheet_dao::insert_file_as_orphan(&database, unassigned)
|
let orphan = sheet_dao::insert_file_as_orphan(database, unassigned)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
sheets.push(orphan);
|
sheets.push(orphan);
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
use std::{
|
use std::{path::PathBuf, sync::Arc};
|
||||||
path::{Path, PathBuf},
|
|
||||||
sync::Arc,
|
|
||||||
};
|
|
||||||
|
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
@ -13,7 +10,7 @@ use relm4::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
database::{self, Database},
|
database::Database,
|
||||||
sheet::{I64DateTime, Sheet},
|
sheet::{I64DateTime, Sheet},
|
||||||
sheet_dao, sheet_validation,
|
sheet_dao, sheet_validation,
|
||||||
ui::mcdu::McduOutput,
|
ui::mcdu::McduOutput,
|
||||||
@ -168,9 +165,7 @@ impl AsyncComponent for AppModel {
|
|||||||
let db = Arc::clone(&self.database);
|
let db = Arc::clone(&self.database);
|
||||||
let dir = Arc::clone(&self.directory);
|
let dir = Arc::clone(&self.directory);
|
||||||
sender.oneshot_command(async move {
|
sender.oneshot_command(async move {
|
||||||
let sheets =
|
sheet_validation::load_and_validate_sheets(&db, dir.as_ref()).await
|
||||||
sheet_validation::load_and_validate_sheets(&db, dir.as_ref()).await;
|
|
||||||
return sheets;
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
AppInput::Sort => self.sheets_listing.emit(SheetListingInput::Sort),
|
AppInput::Sort => self.sheets_listing.emit(SheetListingInput::Sort),
|
||||||
|
@ -8,7 +8,7 @@ use crate::sheet::Sheet;
|
|||||||
|
|
||||||
use super::sheet_model::{OnQueryUpdate, SheetModel};
|
use super::sheet_model::{OnQueryUpdate, SheetModel};
|
||||||
|
|
||||||
use rand::{seq::SliceRandom, thread_rng};
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
pub struct SheetListingModel {
|
pub struct SheetListingModel {
|
||||||
sheets: FactoryVecDeque<SheetModel>,
|
sheets: FactoryVecDeque<SheetModel>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user