From 2abad062653f463e7772ad3b46adc3d1796b43ea Mon Sep 17 00:00:00 2001 From: mortezaei Date: Fri, 21 Aug 2026 22:39:03 +0330 Subject: [PATCH] fix(questions): accurately compute isAnswered for birthplace objects and strings --- src/app/questions-list/[slug]/question-detail-client.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/questions-list/[slug]/question-detail-client.tsx b/src/app/questions-list/[slug]/question-detail-client.tsx index b296194..4d5a043 100644 --- a/src/app/questions-list/[slug]/question-detail-client.tsx +++ b/src/app/questions-list/[slug]/question-detail-client.tsx @@ -17,6 +17,7 @@ import { } from "@/components/Componentes/question-answer-storage"; import QuestionExitNavigationButton from "@/components/Componentes/question-exit-navigation-button"; import QuestionRenderer from "@/components/Componentes/question-renderer"; +import { parseValue as parseBirthplaceValue } from "@/components/Componentes/question-birthplace"; import QuestionSectionFlow from "@/components/Componentes/question-section-flow"; import StickyHeader from "@/components/Componentes/sticky-header"; import TestIntroPage from "@/components/Componentes/test-intro-page"; @@ -197,10 +198,8 @@ function QuestionFlowWrapper({ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; isAnswered = emailRegex.test(String(answer).trim()); } else if (question.type === "birthplace") { - const strVal = String(answer); - const parts = strVal.split(",").map((p) => p.trim()); - isAnswered = - parts.length >= 2 && parts[0].length > 0 && parts[1].length > 0; + const parsed = parseBirthplaceValue(answer); + isAnswered = Boolean(parsed.country?.trim() && parsed.city?.trim()); } else if (question.type === "checkbox") { isAnswered = Array.isArray(answer) ? answer.length > 0 : hasAnswer; }