Skip to content

Commit

Permalink
fix skMax typo, null check, notes in missing exp (#387)
Browse files Browse the repository at this point in the history
Signed-off-by: David <[email protected]>
  • Loading branch information
davidclaveau authored Nov 30, 2024
1 parent 6940434 commit a459343
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
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

0 comments on commit a459343

Please sign in to comment.