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])], } }, });