From 74b770a93709c4a34797c8f83dc58e49740ef203 Mon Sep 17 00:00:00 2001 From: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:51:28 +0530 Subject: [PATCH] fix: summary calculation (#4500) --- .../[surveyId]/(analysis)/summary/lib/surveySummary.ts | 10 +++++----- apps/web/modules/ee/contacts/page.tsx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary.ts b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary.ts index c916d187297..dbef042386e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary.ts +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary.ts @@ -399,7 +399,7 @@ export const getQuestionSummary = async ( value: label, count, percentage: - totalSelectionCount > 0 ? convertFloatTo2Decimal((count / totalSelectionCount) * 100) : 0, + totalResponseCount > 0 ? convertFloatTo2Decimal((count / totalResponseCount) * 100) : 0, }); }); @@ -408,8 +408,8 @@ export const getQuestionSummary = async ( value: getLocalizedValue(lastChoice.label, "default") || "Other", count: otherValues.length, percentage: - totalSelectionCount > 0 - ? convertFloatTo2Decimal((otherValues.length / totalSelectionCount) * 100) + totalResponseCount > 0 + ? convertFloatTo2Decimal((otherValues.length / totalResponseCount) * 100) : 0, others: otherValues.slice(0, VALUES_LIMIT), }); @@ -452,8 +452,8 @@ export const getQuestionSummary = async ( imageUrl: choice.imageUrl, count: choiceCountMap[choice.id], percentage: - totalSelectionCount > 0 - ? convertFloatTo2Decimal((choiceCountMap[choice.id] / totalSelectionCount) * 100) + totalResponseCount > 0 + ? convertFloatTo2Decimal((choiceCountMap[choice.id] / totalResponseCount) * 100) : 0, }); }); diff --git a/apps/web/modules/ee/contacts/page.tsx b/apps/web/modules/ee/contacts/page.tsx index fe955d6a77c..1e27f4d999d 100644 --- a/apps/web/modules/ee/contacts/page.tsx +++ b/apps/web/modules/ee/contacts/page.tsx @@ -84,7 +84,7 @@ export const ContactsPage = async ({ contactAttributeKeys={contactAttributeKeys} isReadOnly={isReadOnly} initialContacts={initialContacts} - hasMore={initialContacts.length <= ITEMS_PER_PAGE} + hasMore={initialContacts.length >= ITEMS_PER_PAGE} refreshContacts={refreshContacts} /> ) : (