|
|
@ -464,6 +464,7 @@ export default function QuestionDetailClient({ |
|
|
"Very High", |
|
|
"Very High", |
|
|
]; |
|
|
]; |
|
|
const defaultLabels = locale === "fa" ? DEFAULT_LABELS_FA : DEFAULT_LABELS_EN; |
|
|
const defaultLabels = locale === "fa" ? DEFAULT_LABELS_FA : DEFAULT_LABELS_EN; |
|
|
|
|
|
const tMap = t as Record<string, string | undefined>; |
|
|
|
|
|
|
|
|
return questionsList |
|
|
return questionsList |
|
|
.filter((q: any) => q && (q.question_number || q.id) && q.text) |
|
|
.filter((q: any) => q && (q.question_number || q.id) && q.text) |
|
|
@ -474,9 +475,9 @@ export default function QuestionDetailClient({ |
|
|
? rawOptions.map((opt: any, idx: number) => { |
|
|
? rawOptions.map((opt: any, idx: number) => { |
|
|
const score = idx + 1; |
|
|
const score = idx + 1; |
|
|
if (typeof opt === "string") { |
|
|
if (typeof opt === "string") { |
|
|
return { id: String(score), value: score, label: t[opt] || opt }; |
|
|
|
|
|
|
|
|
return { id: String(score), value: score, label: tMap[opt] || opt }; |
|
|
} |
|
|
} |
|
|
const defaultLabel = t[DEFAULT_LABELS_EN[idx]] || defaultLabels[idx] || String(score); |
|
|
|
|
|
|
|
|
const defaultLabel = tMap[DEFAULT_LABELS_EN[idx]] || defaultLabels[idx] || String(score); |
|
|
return { |
|
|
return { |
|
|
id: String(opt.id || opt.value || score), |
|
|
id: String(opt.id || opt.value || score), |
|
|
value: typeof opt.value === "number" ? opt.value : score, |
|
|
value: typeof opt.value === "number" ? opt.value : score, |
|
|
@ -488,7 +489,7 @@ export default function QuestionDetailClient({ |
|
|
: [1, 2, 3, 4, 5].map((score, idx) => ({ |
|
|
: [1, 2, 3, 4, 5].map((score, idx) => ({ |
|
|
id: String(score), |
|
|
id: String(score), |
|
|
value: score, |
|
|
value: score, |
|
|
label: t[DEFAULT_LABELS_EN[idx]] || defaultLabels[idx] || String(score), |
|
|
|
|
|
|
|
|
label: tMap[DEFAULT_LABELS_EN[idx]] || defaultLabels[idx] || String(score), |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
|