fix: preserve multi-select choices with custom answers
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user