From 08f9d1b0bfd421778d5acb9d6efbd1c96ee33162 Mon Sep 17 00:00:00 2001 From: jetsparrow Date: Tue, 16 Sep 2025 01:39:25 +0300 Subject: [PATCH] coerce record fields to string in sanitize --- generate-ballots/scripts/create-ballots.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/generate-ballots/scripts/create-ballots.js b/generate-ballots/scripts/create-ballots.js index 7454262..70f7ed5 100644 --- a/generate-ballots/scripts/create-ballots.js +++ b/generate-ballots/scripts/create-ballots.js @@ -41,13 +41,13 @@ function sanitizeRecord(record) const noData="нет данных"; for (var i = 0; i < record.length; ++i) { - if ((""+record[i]).trim().toLowerCase() == noData) + if (!record[i] || (""+record[i]).trim().toLowerCase() == noData) { record[i] = ""; } - else if(!record[i]) + else { - record[i] = ""; + record[i] = ""+record[i]; } } return record; @@ -69,23 +69,23 @@ async function populateBallot(template, record){ patches: { APT_NUM: { type: PatchType.PARAGRAPH, - children: [ new TextRun(""+record[2])], + children: [ new TextRun(record[2])], }, FIO: { type: PatchType.PARAGRAPH, - children: [ new TextRun(""+record[3])], + children: [ new TextRun(record[3])], }, APT_AREA: { type: PatchType.PARAGRAPH, - children: [ new TextRun(""+record[5])], + children: [ new TextRun(record[5])], }, SHARE: { type: PatchType.PARAGRAPH, - children: [ new TextRun(""+record[6])], + children: [ new TextRun(record[6])], }, DOCUMENT_NUM: { type: PatchType.PARAGRAPH, - children: [ new TextRun(""+record[8])], + children: [ new TextRun(record[8])], }, DOCUMENT_DATE: { type: PatchType.PARAGRAPH, @@ -93,7 +93,7 @@ async function populateBallot(template, record){ }, SNILS: { type: PatchType.PARAGRAPH, - children: [ new TextRun(""+record[10])], + children: [ new TextRun(record[10])], } }, });