fix: preserve multi-select choices with custom answers

This commit is contained in:
Erik Kotsiuba
2026-04-19 16:32:27 +02:00
parent 4a131f7752
commit 8d8e7b67c9
8 changed files with 157 additions and 14 deletions
+6 -2
View File
@@ -37,19 +37,23 @@ function formatAnswerLine(
answer: AskResult["answers"][string],
mode: "summary" | "render"
): string | undefined {
const answerText = answer.customText ?? answer.labels.join(", ");
const answerText = answer.labels.join(", ");
if (!answerText) {
return;
}
if (mode === "summary") {
return `${questionLabel}: ${answerText}`;
}
if (answer.customText) {
if (isCustomOnlyAnswer(answer)) {
return `✓ ${questionLabel}: (wrote) ${answerText}`;
}
return `✓ ${questionLabel}: ${answerText}`;
}
function isCustomOnlyAnswer(answer: AskResult["answers"][string]): boolean {
return answer.indices.length === 0 && !!answer.customText;
}
function formatQuestionNoteLine(
questionLabel: string,
note: string | undefined,