Skip to content

Commit

Permalink
Fix bugs with getting valid permit
Browse files Browse the repository at this point in the history
  • Loading branch information
sggerard committed Jun 28, 2024
1 parent 532a40a commit f78d650
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions api/src/integrations/core/datasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,12 @@ class CoreDataSource {

// Create a new collections if possible.
if (savedRecord._schemaName === 'MineBCMI') {
await this.createorUpdateCollections(collectionUtils, permitUtils, permitInfo.permit, savedRecord);
await this.createorUpdateCollections(collectionUtils, permitUtils, permitInfo.validPermit, savedRecord);
} else {
if (!savedRecord.length > 0 || savedRecord[0].status !== 'success') {
throw Error('processRecord - savedRecord is null.');
}
await this.createorUpdateCollections(collectionUtils, permitUtils, permitInfo.permit, savedRecord[0].object[0]);
await this.createorUpdateCollections(collectionUtils, permitUtils, permitInfo.validPermit, savedRecord[0].object[0]);
}

this.status.itemsProcessed++;
Expand Down Expand Up @@ -277,7 +277,7 @@ class CoreDataSource {

// Do not use 'G-4-352' for Lumby
// https://bcmines.atlassian.net/browse/NRPT-684
return !nrptiRecord.name === 'Lumby Mine' && permit.permit_no === 'G-4-352';
return !(nrptiRecord.name === 'Lumby Mine' && permit.permit_no === 'G-4-352');
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/integrations/core/mine-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Mines extends BaseRecordUtils {
// The permit information is updated separately and the NRPTI record will not contain it.
// Copy permit information over before updating to preserve it.
nrptiRecord.permittee = permitInfo.permittee;
nrptiRecord.permit = permitInfo.permit;
nrptiRecord.permit = permitInfo.validPermit;
nrptiRecord.permitNumber = permitInfo.permitNumber;

return super.updateRecord(nrptiRecord, existingRecord);
Expand Down

0 comments on commit f78d650

Please sign in to comment.