From f2ff3f1df3814f43aabbe353b9744be33d222031 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 7 Jun 2025 09:00:59 +0200 Subject: [PATCH] fix --- backend/src/graphql/resolver/util/contributions.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/src/graphql/resolver/util/contributions.ts b/backend/src/graphql/resolver/util/contributions.ts index 6c68d81ac..ac36368d2 100644 --- a/backend/src/graphql/resolver/util/contributions.ts +++ b/backend/src/graphql/resolver/util/contributions.ts @@ -101,12 +101,13 @@ export const contributionFrontendLink = async ( contributionId: number, createdAt: Date, ): Promise => { + // TODO: page is sometimes wrong, use page 1 for now, and fix later with more time at hand // simplified, don't account for order by id, so when the nearly impossible case occur that createdAt is the same for two contributions, // maybe it is the wrong page - const countBefore = await DbContribution.count({ - where: { createdAt: MoreThan(createdAt) }, - }) - const page = Math.floor(countBefore / DEFAULT_PAGINATION_PAGE_SIZE) + 1 + //const countBefore = await DbContribution.count({ + //where: { createdAt: MoreThan(createdAt) }, + //}) + // const page = Math.floor(countBefore / DEFAULT_PAGINATION_PAGE_SIZE) + 1 const anchor = `${FRONTEND_CONTRIBUTIONS_ITEM_ANCHOR_PREFIX}${contributionId}` - return `${CONFIG.COMMUNITY_URL}/contributions/own-contributions/${page}#${anchor}` + return `${CONFIG.COMMUNITY_URL}/contributions/own-contributions/#${anchor}` }