Skip to content

Commit

Permalink
Add new customFields to report generation data
Browse files Browse the repository at this point in the history
  • Loading branch information
yeln4ts committed May 20, 2021
1 parent 8d6edeb commit 404420d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions backend/src/lib/report-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,10 @@ async function prepAuditData(data) {
var fieldType = field.customField.fieldType
var label = field.customField.label

if (fieldType === 'input')
result[_.deburr(label.toLowerCase()).replace(/\s/g, '')] = field.text
else if (fieldType === 'text')
if (fieldType === 'text')
result[_.deburr(label.toLowerCase()).replace(/\s/g, '')] = await splitHTMLParagraphs(field.text)
else if (fieldType !== 'space')
result[_.deburr(label.toLowerCase()).replace(/\s/g, '')] = field.text
}
}

Expand Down Expand Up @@ -373,10 +373,10 @@ async function prepAuditData(data) {
var fieldType = field.fieldType
var label = field.label
}
if (fieldType === 'input')
tmpFinding[_.deburr(label.toLowerCase()).replace(/\s/g, '').replace(/[^\w]/g, '_')] = field.text
else if (fieldType === 'text')
if (fieldType === 'text')
tmpFinding[_.deburr(label.toLowerCase()).replace(/\s/g, '').replace(/[^\w]/g, '_')] = await splitHTMLParagraphs(field.text)
else if (fieldType !== 'space')
tmpFinding[_.deburr(label.toLowerCase()).replace(/\s/g, '').replace(/[^\w]/g, '_')] = field.text
}
}
result.findings.push(tmpFinding)
Expand All @@ -400,15 +400,15 @@ async function prepAuditData(data) {
for (field of section.customFields) {
var fieldType = field.customField.fieldType
var label = field.customField.label
if (fieldType === 'input')
formatSection[_.deburr(label.toLowerCase()).replace(/\s/g, '').replace(/[^\w]/g, '_')] = field.text
else if (fieldType === 'text')
if (fieldType === 'text')
formatSection[_.deburr(label.toLowerCase()).replace(/\s/g, '').replace(/[^\w]/g, '_')] = await splitHTMLParagraphs(field.text)
else if (fieldType !== 'space')
formatSection[_.deburr(label.toLowerCase()).replace(/\s/g, '').replace(/[^\w]/g, '_')] = field.text
}
}
result[section.field] = formatSection
}

return result
}

Expand Down

0 comments on commit 404420d

Please sign in to comment.