forked from didirus/AstralRinth
Fix featured versions sorting (#166)
* Reports WIP * Finish reports * Clippy fixes * Fix featured versions sorting Co-authored-by: Geometrically <geometrically@pop-os.localdomain>
This commit is contained in:
@@ -51,7 +51,7 @@ pub async fn version_list(
|
||||
.await
|
||||
.map_err(|e| ApiError::DatabaseError(e.into()))?;
|
||||
|
||||
let versions = database::models::Version::get_many_full(version_ids, &**pool)
|
||||
let mut versions = database::models::Version::get_many_full(version_ids, &**pool)
|
||||
.await
|
||||
.map_err(|e| ApiError::DatabaseError(e.into()))?;
|
||||
|
||||
@@ -67,6 +67,8 @@ pub async fn version_list(
|
||||
.map(convert_version)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
versions.sort_by(|a, b| b.date_published.cmp(&a.date_published));
|
||||
|
||||
// Attempt to populate versions with "auto featured" versions
|
||||
if response.is_empty() && !versions.is_empty() && filters.featured.unwrap_or(false) {
|
||||
database::models::categories::GameVersion::list_filter(None, Some(true), &**pool)
|
||||
|
||||
Reference in New Issue
Block a user