fix: use <= when compareing release types

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-05-26 17:16:50 -07:00
parent 832a61f886
commit 2680dba0aa
5 changed files with 13 additions and 4 deletions

View File

@ -70,8 +70,17 @@ struct IndexedVersionType {
IndexedVersionType& operator=(const IndexedVersionType& other);
bool operator==(const IndexedVersionType& other) const { return m_type == other.m_type; }
bool operator==(const IndexedVersionType::Enum& type) const { return m_type == type; }
bool operator!=(const IndexedVersionType& other) const { return m_type != other.m_type; }
bool operator!=(const IndexedVersionType::Enum& type) const { return m_type != type; }
bool operator<(const IndexedVersionType& other) const { return m_type < other.m_type; }
bool operator<(const IndexedVersionType::Enum& type) const { return m_type < type; }
bool operator<=(const IndexedVersionType& other) const { return m_type <= other.m_type; }
bool operator<=(const IndexedVersionType::Enum& type) const { return m_type <= type; }
bool operator>(const IndexedVersionType& other) const { return m_type > other.m_type; }
bool operator>(const IndexedVersionType::Enum& type) const { return m_type > type; }
bool operator>=(const IndexedVersionType& other) const { return m_type >= other.m_type; }
bool operator>=(const IndexedVersionType::Enum& type) const { return m_type >= type; }
QString toString() const { return toString(m_type); }
IndexedVersionType::Enum m_type;

View File

@ -144,7 +144,7 @@ auto FlameAPI::getLatestVersion(VersionSearchArgs&& args) -> ModPlatform::Indexe
for (auto file : arr) {
auto file_obj = Json::requireObject(file);
auto file_tmp = FlameMod::loadIndexedPackVersion(file_obj);
bool better_release = file_tmp.verison_type < ver_tmp.verison_type;
bool better_release = file_tmp.verison_type <= ver_tmp.verison_type;
if(file_tmp.date > ver_tmp.date && better_release) {
ver_tmp = file_tmp;
latest_file_obj = file_obj;

View File

@ -94,7 +94,7 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
}
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
bool a_better_release = a.verison_type < b.verison_type;
bool a_better_release = a.verison_type <= b.verison_type;
// dates are in RFC 3339 format
return a.date > b.date && a_better_release;
};

View File

@ -109,7 +109,7 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
unsortedVersions.append(file);
}
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
bool a_better_release = a.verison_type < b.verison_type;
bool a_better_release = a.verison_type <= b.verison_type;
// dates are in RFC 3339 format
return a.date > b.date && a_better_release;
};

View File

@ -111,7 +111,7 @@ void loadIndexedVersions(Modpack& pack, QJsonDocument& doc)
unsortedVersions.append(file);
}
auto orderSortPredicate = [](const ModpackVersion& a, const ModpackVersion& b) -> bool {
bool a_better_release = a.version_type < b.version_type;
bool a_better_release = a.version_type <= b.version_type;
// dates are in RFC 3339 format
return a.date > b.date && a_better_release;
};