Skip to content

Commit

Permalink
fix: summary calculation (formbricks#4500)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruwang authored Dec 19, 2024
1 parent bd8724c commit 74b770a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});

Expand All @@ -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),
});
Expand Down Expand Up @@ -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,
});
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/modules/ee/contacts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/>
) : (
Expand Down

0 comments on commit 74b770a

Please sign in to comment.