From 0a665ab55313c964462334210c67b4f419bd1689 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sat, 25 Jul 2026 02:28:06 +0200 Subject: [PATCH] Ordering stashes by last stashed item. --- components/stashes/heart.vue | 2 -- src/stashes.js | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/stashes/heart.vue b/components/stashes/heart.vue index 2d1c863..8a0dbbe 100644 --- a/components/stashes/heart.vue +++ b/components/stashes/heart.vue @@ -41,8 +41,6 @@ const itemAlerts = ref(props.item.alerts); const itemAlerted = ref(props.item.alerts?.only.length > 0); const hasSecondaryStash = computed(() => itemStashes.value.some((itemStash) => !itemStash.isPrimary)); -// console.log(props.item); - const done = ref(true); const stashMenuDropdownId = useId(); const stashTogglesDropdownId = useId(); diff --git a/src/stashes.js b/src/stashes.js index 40a3ff1..ef21321 100755 --- a/src/stashes.js +++ b/src/stashes.js @@ -29,6 +29,7 @@ export function curateStash(stash, assets = {}) { stashedScenes: stash.stashed_scenes ?? null, stashedMovies: stash.stashed_movies ?? null, stashedActors: stash.stashed_actors ?? null, + lastStashAt: stash.last_stash_at, user: assets.user ? { id: assets.user.id, @@ -150,7 +151,12 @@ export async function fetchUserStashes(usernameOrId, reqUser) { if (userId !== reqUser?.id) { builder.where('public', true); } - }); + }) + .orderBy([ + { column: 'stashes.primary', order: 'desc' }, + { column: 'stashes_meta.last_stash_at', order: 'desc' }, + { column: 'stashes.name', order: 'asc' }, + ]); return stashes.map((stash) => curateStash(stash, { user: reqUser })); }