From b8b2dee4a484387602814751eff2e63c7e13b89d Mon Sep 17 00:00:00 2001 From: pluja Date: Mon, 9 Jun 2025 14:33:57 +0000 Subject: [PATCH] Release 202506091433 --- web/src/pages/index.astro | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index 6c8a08f..f4e7ded 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -333,6 +333,8 @@ const [categories, [services, totalServices], countCommunityOnly, attributes] = where, select: { id: true, + serviceVisibility: true, + verificationStatus: true, ...(Object.fromEntries(sortOptions.map((option) => [option.orderBy.key, true])) as Record< (typeof sortOptions)[number]['orderBy']['key'], true @@ -354,10 +356,18 @@ const [categories, [services, totalServices], countCommunityOnly, attributes] = sortBy(unsortedServices, 'id'), [ ...(filters.q ? (['similarityScore'] as const) : ([] as const)), + (service) => (service.verificationStatus === 'VERIFICATION_FAILED' ? 1 : 0), + (service) => (service.serviceVisibility === 'ARCHIVED' ? 1 : 0), selectedSort.orderBy.key, () => rng(), ], - [...(filters.q ? (['desc'] as const) : ([] as const)), selectedSort.orderBy.direction, 'asc'] + [ + ...(filters.q ? (['desc'] as const) : ([] as const)), + 'asc', + 'asc', + selectedSort.orderBy.direction, + 'asc', + ] ).slice((filters.page - 1) * PAGE_SIZE, filters.page * PAGE_SIZE) const unsortedServicesWithInfoMissingSimilarityScore = await prisma.service.findMany({ @@ -410,11 +420,19 @@ const [categories, [services, totalServices], countCommunityOnly, attributes] = unsortedServicesWithInfo, [ ...(filters.q ? (['similarityScore'] as const) : ([] as const)), + (service) => (service.verificationStatus === 'VERIFICATION_FAILED' ? 1 : 0), + (service) => (service.serviceVisibility === 'ARCHIVED' ? 1 : 0), selectedSort.orderBy.key, // Now we can shuffle indeternimistically, because the pagination was already applied () => Math.random(), ], - [...(filters.q ? (['desc'] as const) : ([] as const)), selectedSort.orderBy.direction, 'asc'] + [ + ...(filters.q ? (['desc'] as const) : ([] as const)), + 'asc', + 'asc', + selectedSort.orderBy.direction, + 'asc', + ] ) return [sortedServicesWithInfo, totalServices] as const