mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-20 03:00:57 -06:00
fix nps summary NaN bug, fix add question not working for some question types
This commit is contained in:
@@ -59,8 +59,11 @@ export default function QuestionCard({
|
||||
</div>
|
||||
<Collapsible.Root
|
||||
open={open}
|
||||
onOpenChange={(open) => {
|
||||
setActiveQuestionId(open ? question.id : null);
|
||||
onOpenChange={() => {
|
||||
if (activeQuestionId !== question.id) {
|
||||
// only be able to open other question
|
||||
setActiveQuestionId(question.id);
|
||||
}
|
||||
}}
|
||||
className="flex-1 rounded-r-lg border border-slate-200">
|
||||
<Collapsible.CollapsibleTrigger
|
||||
|
||||
@@ -17,6 +17,7 @@ interface Result {
|
||||
}
|
||||
|
||||
export default function NPSSummary({ questionSummary }: NPSSummaryProps) {
|
||||
console.log(questionSummary);
|
||||
const percentage = (count, total) => {
|
||||
return count / total;
|
||||
};
|
||||
@@ -32,7 +33,7 @@ export default function NPSSummary({ questionSummary }: NPSSummaryProps) {
|
||||
|
||||
for (let response of questionSummary.responses) {
|
||||
const value = response.value;
|
||||
if (!value || typeof value !== "number") continue;
|
||||
if (typeof value !== "number") continue;
|
||||
|
||||
data.total++;
|
||||
if (value >= 9) {
|
||||
|
||||
@@ -5,8 +5,12 @@ export const replaceQuestionPresetPlaceholders = (question: Question, product) =
|
||||
if (!question) return;
|
||||
if (!product) return question;
|
||||
const newQuestion = JSON.parse(JSON.stringify(question));
|
||||
newQuestion.headline = newQuestion.headline.replace("{{productName}}", product.name);
|
||||
newQuestion.subheader = newQuestion.subheader?.replace("{{productName}}", product.name);
|
||||
if (newQuestion.headline) {
|
||||
newQuestion.headline = newQuestion.headline.replace("{{productName}}", product.name);
|
||||
}
|
||||
if (newQuestion.subheader) {
|
||||
newQuestion.subheader = newQuestion.subheader?.replace("{{productName}}", product.name);
|
||||
}
|
||||
return newQuestion;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user