Sort modpack entries by version, rather than publishing date

This fixes issues the display order while using packs like Fabolously Optimized, who release
versions out of order

Signed-off-by: TheCourierNV <andreascart04@gmail.com>
This commit is contained in:
TheCourierNV 2026-03-12 22:19:33 +01:00
parent 8cb9262b09
commit 9e3893fd62
No known key found for this signature in database
GPG key ID: FA5E30F19504B1D6

View file

@ -2,6 +2,7 @@
#include "Application.h"
#include "Json.h"
#include "Version.h"
#include "net/NetJob.h"
#include "modplatform/ModIndex.h"
@ -114,8 +115,7 @@ Task::Ptr ResourceAPI::getProjectVersions(VersionSearchArgs&& args, Callback<QVe
}
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
// dates are in RFC 3339 format
return a.date > b.date;
return Version(a.version) > Version(b.version);
};
std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate);
} catch (const JSONValidationError& e) {