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-384: Update Missing Export for "No Data" #376

Merged
merged 1 commit into from
Oct 4, 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
14 changes: 14 additions & 0 deletions arSam/handlers/export-missing/invokable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ exports.handler = async (event, context) => {

// collect missing records, use VARIANCE_STATE as it's the same
const records = await getMissingRecords(fiscalYearEnd, roles, orcs);

if (!records.length) {
await updateJobWithState(VARIANCE_STATE_DICTIONARY.NODATA);
return
}

await updateJobWithState(VARIANCE_STATE_DICTIONARY.FORMATTING);

// format records for csv
Expand Down Expand Up @@ -101,6 +107,14 @@ async function updateJobWithState(state, percentageOverride = null) {
state = 'error';
message = 'Job failed. Exporter encountered an error.';
break;

// no data, no report
case 0:
state = 'no_data';
percentage = percentageOverride || 100;
message = 'No data - no report generated.';
break;

// fetching data
case 1:
state = 'fetching_data';
Expand Down
1 change: 1 addition & 0 deletions arSam/layers/constantsLayer/constantsLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const STATE_DICTIONARY = {

VARIANCE_STATE_DICTIONARY = {
ERROR: 99,
NODATA: 0,
FETCHING: 1,
FORMATTING: 2,
GENERATING: 3,
Expand Down
Loading