Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BRS-237 - Migration for Historical Data 2000-2016 #389

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions arSam/handlers/export/invokable/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
const fs = require("fs");
const writeXlsxFile = require("write-excel-file/node");
const {
TABLE_NAME,
getParks,
getSubAreas,
getRecords,
logger,
s3Client,
PutObjectCommand
} = require("/opt/baseLayer");
const {
EXPORT_NOTE_KEYS,
EXPORT_MONTHS,
CSV_SYSADMIN_SCHEMA,
STATE_DICTIONARY,
} = require("/opt/constantsLayer");
const { updateJobEntry } = require("/opt/functionsLayer");
const fs = require('fs');
const writeXlsxFile = require('write-excel-file/node');
const { DateTime } = require('luxon');
const { TABLE_NAME, getParks, getSubAreas, getRecords, logger, s3Client, PutObjectCommand } = require('/opt/baseLayer');
const { EXPORT_NOTE_KEYS, EXPORT_MONTHS, CSV_SYSADMIN_SCHEMA, STATE_DICTIONARY } = require('/opt/constantsLayer');
const { updateJobEntry } = require('/opt/functionsLayer');

const {
arraySum,
Expand Down Expand Up @@ -161,6 +149,11 @@ async function getAllRecords(roles = null, dateRangeStart = null, dateRangeEnd =
subareas = subareas.concat(parkSubAreas);
}
}
// Don't get records before 2017, all will be historical anyway
if (dateRangeStart == 'null' && dateRangeEnd == 'null') {
dateRangeStart = '2017-01';
dateRangeEnd = DateTime.now().setZone('America/Vancouver').toFormat('yyyyLL');
}
for (const subarea of subareas) {
const subAreaRecords = await getRecords(subarea, subarea.bundle, subarea.section, subarea.region, true, false, dateRangeStart, dateRangeEnd);
records = records.concat(subAreaRecords);
Expand Down
3 changes: 2 additions & 1 deletion arSam/handlers/export/invokable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"author": "Team Osprey",
"dependencies": {
"write-excel-file": "^1.3.16"
"write-excel-file": "^1.3.16",
"luxon": "^3.2.1"
}
}
Loading
Loading