Skip to content

Commit

Permalink
Added new column through constants, added resolved state to new colum…
Browse files Browse the repository at this point in the history
…n, changed new lines in notes to an additional space to fix errors on csv (#239)
  • Loading branch information
Christopher-walsh22 authored Oct 24, 2023
1 parent 9259c16 commit cba7e97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lambda/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ const CSV_SYSADMIN_SCHEMA = [
];

VARIANCE_CSV_SCHEMA = [
'Bundle', 'ORCS', 'Park Name', 'Sub-area Name', 'Sub-area ID', 'Activity', 'Year', 'Month', 'Notes', 'Variances'
'Bundle', 'ORCS', 'Park Name', 'Sub-area Name', 'Sub-area ID', 'Activity', 'Year', 'Month', 'Notes', 'Variances', 'Resolved'
]

module.exports = {
Expand Down
8 changes: 7 additions & 1 deletion lambda/export-variance/invokable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ function formatRecords(records) {
const date = record.pk.split('::')[2];
record['year'] = date.slice(0, 4);
record['month'] = date.slice(4);
record['resolved'] = record.resolved ? 'YES' : 'NO';
if (/\r\n|\n|\r/.test(record.notes)) {
record.notes = record.notes.replace(/(\r\n|\n|\r)/g, ' ');
}

}
}

Expand All @@ -253,7 +258,8 @@ function createCSV(records) {
record.year || 'N/A',
record.month || 'N/A',
record.notes || '',
record.fields || ''
record.fields || '',
record.resolved || ''
])
}
let csvData = '';
Expand Down

0 comments on commit cba7e97

Please sign in to comment.