make defaultSort logic easier to follow

This commit is contained in:
Cameron McDonald 2024-08-16 12:59:13 -05:00
parent 006476b4c6
commit 6239fe5a72

View file

@ -218,13 +218,13 @@ void SetList::defaultSort()
CardSet::Priority bPriority = b->getPriority() ? b->getPriority() : CardSet::PriorityFallback; CardSet::Priority bPriority = b->getPriority() ? b->getPriority() : CardSet::PriorityFallback;
// Sort by priority, then by release date, then by short name // Sort by priority, then by release date, then by short name
if (aPriority == bPriority) { if (aPriority != bPriority) {
if (aDate.daysTo(bDate) == 0) { return aPriority < bPriority;
return a->getShortName().compare(b->getShortName()) < 0; }
} if (aDate.daysTo(bDate) != 0) {
return aDate.daysTo(bDate) < 0; return aDate.daysTo(bDate) < 0;
} }
return aPriority < bPriority; return a->getShortName().compare(b->getShortName()) < 0;
}); });
} }