-
Notifications
You must be signed in to change notification settings - Fork 14
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
[BUG][NRPTI-1242] Add support for creating & updating permits from multiple permit codes #1248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No red flags stand out :) Just some minor formatting inconsistency and one small suggestion
if (nrptiRecord.name === 'Lumby Mine' && permit.permit_no === 'G-4-352') { | ||
return false; | ||
} | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the if determines the return, couldn't the return just be the !inverse
of the if.
If the intent isn't clear it could be assigned to a variable before the return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sure can! The sonarcloud robots agree with you too ;)
return permits.filter(p => this.isValidPermit(p,nrptiRecord)); | ||
} | ||
|
||
isValidPermit(permit,nrptiRecord){ | ||
//Mine must not be historical which is indicated by an authorized year of '9999' on the latest amendment. | ||
if((permit.permit_amendments.length && !permit.permit_amendments[0].authorization_end_date) | ||
|| permit.permit_status_code === 'O'){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor formatting inconsistencies to the rest of the file with regards to whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spotting! I did see this when I reviewed the PR too, surprised the linter didn't catch it
Quality Gate passedIssues Measures |
…ltiple permit codes (#1248) * Add support for creating permits from multiple permit codes * Fix test method calls * Fix whitespace and replace if-then-else with single return statement
Pull Request Standards
Description
Previously only the most recent valid permit was selected for a mine and records processed for the permit. However requirements changed and now both M and MX records need to be publicly available. A hotfix hotfix was deployed but did not address the underlying problem leading to syncing issues. This PR attempts to properly implement a solution.
This PR includes the following proposed change(s):
Replaces getMinePermit() with getMinePermits() and separates the logic out into multiple methods so that createMinePermit() and updateMinePermit() can process multiple mine permits instead of only the currently selected valid Mine Permit. This allows both MX and M permits and collections for a single mine to be processed during the cron run.