fix(shop): prioritize user's hearted items in favorites sort

User's own hearted items now sort first, then by global wishlist
count within each group. Previously global count came first which
buried your own favorites if they weren't popular.
This commit is contained in:
End Nightshade 2026-02-17 10:00:57 -07:00
parent 27bc8647a9
commit 12275b553a
No known key found for this signature in database
3 changed files with 5 additions and 5 deletions

View file

@ -106,7 +106,7 @@ export default {
sort: 'sort:',
default: 'default',
favorites: 'favorites',
favoritesSortHint: 'most wished, then yours',
favoritesSortHint: 'yours first, then most wished',
probability: 'probability',
cost: 'cost (low to high)',
loadingItems: 'Loading items...',

View file

@ -106,7 +106,7 @@ export default {
sort: 'ordenar:',
default: 'predeterminado',
favorites: 'favoritos',
favoritesSortHint: 'más deseados, luego los tuyos',
favoritesSortHint: 'los tuyos primero, luego más deseados',
probability: 'probabilidad',
cost: 'costo (bajo a alto)',
loadingItems: 'Cargando artículos...',

View file

@ -60,12 +60,12 @@
let items = [...filteredItems];
if (sortBy === 'favorites') {
return items.sort((a, b) => {
if (b.heartCount !== a.heartCount) {
return b.heartCount - a.heartCount;
}
if (a.userHearted !== b.userHearted) {
return a.userHearted ? -1 : 1;
}
if (b.heartCount !== a.heartCount) {
return b.heartCount - a.heartCount;
}
return a.id - b.id;
});
} else if (sortBy === 'probability') {