Skip to content

Commit

Permalink
Account for commas in Notes, and Park names. Percent values in varian…
Browse files Browse the repository at this point in the history
…ces are limited to 2 decimal points. (#241)
  • Loading branch information
Christopher-walsh22 authored Oct 30, 2023
1 parent 4e60c42 commit ff506f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lambda/export-variance/invokable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ function formatRecords(records) {
if (record.fields.length > 0) {
let fields = [];
for (const field of record.fields) {
fields.push(String(field.key + " " + parseFloat(field.percentageChange) * 100 + "%"));
const percent = (parseFloat(field.percentageChange) * 100).toFixed(2);
fields.push(String(field.key + " " + percent + "%"));
}
record['fields'] = fields.join("; ");
}
Expand All @@ -250,13 +251,13 @@ function createCSV(records) {
content.push([
record.bundle || 'N/A',
record.orcs || 'N/A',
record.parkName || 'N/A',
`"${record.parkName || 'N/A'}"`,
record.subAreaName || 'N/A',
record.subAreaId || 'N/A',
record.sk.split('::')[1] || 'N/A',
record.year || 'N/A',
record.month || 'N/A',
record.notes || '',
`"${record.notes || ''}"`,
record.fields || '',
record.resolved || ''
])
Expand Down

0 comments on commit ff506f2

Please sign in to comment.