diff --git a/sr_download/src/db_part/defines/full_data_view.rs b/sr_download/src/db_part/defines/full_data_view.rs index 5db7b8f..c88b626 100644 --- a/sr_download/src/db_part/defines/full_data_view.rs +++ b/sr_download/src/db_part/defines/full_data_view.rs @@ -8,6 +8,7 @@ SELECT md.blake_hash, md.xml_tested, md.len, + md.time, CASE WHEN md.len > 1024 THEN ld.text diff --git a/sr_download/src/db_part/defines/ships_table.rs b/sr_download/src/db_part/defines/ships_table.rs index 1b297b9..17f6009 100644 --- a/sr_download/src/db_part/defines/ships_table.rs +++ b/sr_download/src/db_part/defines/ships_table.rs @@ -29,7 +29,7 @@ pub fn ships_table() -> Statement { .boolean() .not_null(), ); - // .col(ColumnDef::new(Ships::XmlData)); + // .col(ColumnDef::new(Ships::XmlData)); DatabaseBackend::Postgres.build(&table) } diff --git a/sr_download/src/web_part.rs b/sr_download/src/web_part.rs index 0012183..f9b66de 100644 --- a/sr_download/src/web_part.rs +++ b/sr_download/src/web_part.rs @@ -194,18 +194,28 @@ const INFO_PAGE: &str = include_str!("info.html"); async fn dashboard_page(State(db): State) -> Html { let max_id = db_part::search::max_id(&db).await; - let max_id_data = DbData::from_db(max_id, &db).await.unwrap(); + let max_id_data = DbData::from_db(max_id, &db).await; let max_ship = db_part::search::max_ship(&db).await; let max_save = db_part::search::max_save(&db).await; - let mut page_content = INFO_PAGE - .replace("|MAX_ID|", &max_id_data.save_id.to_string()) - .replace( - "|MAX_SAVE_TYPE|", - &max_id_data.save_type.to_value().to_string(), - ) - .replace("|MAX_LEN|", &max_id_data.len.to_string()) - .replace("|MAX_HASH|", &max_id_data.blake_hash); + let mut page_content = INFO_PAGE.replace("|MAX_ID|", &max_id.to_string()); + + if let Some(max_id_data) = max_id_data { + page_content = page_content + .replace("|MAX_ID|", &max_id_data.save_id.to_string()) + .replace( + "|MAX_SAVE_TYPE|", + &max_id_data.save_type.to_value().to_string(), + ) + .replace("|MAX_LEN|", &max_id_data.len.to_string()) + .replace("|MAX_HASH|", &max_id_data.blake_hash); + } else { + page_content = page_content + .replace("|MAX_ID|", "not found") + .replace("|MAX_SAVE_TYPE|", "not found") + .replace("|MAX_LEN|", "not found") + .replace("|MAX_HASH|", "not found"); + } if let Some(max_ship) = max_ship { page_content = page_content .replace("|MAX_SHIP_ID|", &max_ship.save_id.to_string()) diff --git a/update.md b/update.md index 69db86c..9ced8b8 100644 --- a/update.md +++ b/update.md @@ -6,6 +6,8 @@ 然后遇到了 sea_orm 不支持 xml 类型的问题 先发一版再说 +顺便修复了web界面的一些可能导致 panic 的 unwrap + ## 1.2.4 又修复了一遍剩下的问题