Improve homepage demo list

This commit is contained in:
Lol3rrr
2024-10-16 12:48:02 +02:00
parent 2f29c9ea67
commit 69139261cc
7 changed files with 110 additions and 4 deletions

View File

@@ -68,6 +68,7 @@ async fn list(
.or_insert(common::BaseDemoInfo {
id: demo.demo_id,
map: info.map,
uploaded_at: demo.uploaded_at,
team2_score: 0,
team3_score: 0,
});
@@ -81,9 +82,9 @@ async fn list(
}
}
// TODO
// Sort this
let mut output = demos.into_values().collect::<Vec<_>>();
output.sort_unstable_by_key(|d| d.uploaded_at);
Ok(axum::response::Json(output))
}

View File

@@ -23,7 +23,7 @@ pub struct NewDemo {
pub struct Demo {
pub steam_id: String,
pub demo_id: String,
pub uploaded_at: diesel::data_types::PgTimestamp,
pub uploaded_at: chrono::naive::NaiveDateTime,
}
#[derive(Queryable, Selectable, Insertable, Debug)]