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-254-Fix: skMax Typo, null Check, and a Fix to the Notes in Missing Export #387

Merged
merged 1 commit into from
Nov 30, 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
2 changes: 1 addition & 1 deletion arSam/handlers/export-missing/invokable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ function createCSV(missingRecords, fiscalYearEnd) {
// Not missing data, add empty space to that column
subAreaRow.push('');
}
subAreaRow.push(missingRecord[bundle][park].notes || ''); // Notes
subAreaRow.push(`"${missingRecord[bundle][park][date].notes}"` || ''); // Notes
}

// Add these to the start of the array because we might not have subAreaName early on
Expand Down
21 changes: 15 additions & 6 deletions arSam/layers/baseLayer/baseLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,16 @@ async function getSubAreas(orcs, includeLegacy = true) {
// pass the full subarea object.
// pass filter = false to look for every possible activity
// includeLegacy = false will only return records that are not marked as legacy.
async function getRecords(subArea, bundle, section, region, filter = true, includeLegacy = true, skMin = null, skMax = null) {
async function getRecords(
subArea,
bundle,
section,
region,
filter = true,
includeLegacy = true,
skMin = 'null',
skMax = 'null'
) {
let records = [];
let filteredActivityList = RECORD_ACTIVITY_LIST;
if (filter && subArea.activities) {
Expand All @@ -338,14 +347,14 @@ async function getRecords(subArea, bundle, section, region, filter = true, inclu
}
};
//if exported with date range
if (skMin && skMax) {
skMin = skMin.replace("-","");
skMin = skMin.replace("-","");
if (skMin !== 'null' && skMax !== 'null') {
skMin = skMin.replace('-', '');
skMax = skMax.replace('-', '');

recordQuery.KeyConditionExpression += ` AND sk BETWEEN :skMin AND :skMax`;
recordQuery.ExpressionAttributeValues[':skMin'] = { S: skMin };
recordQuery.ExpressionAttributeValues[':skMax'] = { S: skMax };
};
}
if (!includeLegacy) {
recordQuery.FilterExpression = 'isLegacy = :legacy OR attribute_not_exists(isLegacy)';
recordQuery.ExpressionAttributeValues[':legacy'] = { BOOL: false };
Expand Down