-
Notifications
You must be signed in to change notification settings - Fork 0
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
ADJUST1-530 unused deductions banner make reason specific #259
ADJUST1-530 unused deductions banner make reason specific #259
Conversation
I don't think 'NONE' should be returned whenever it was false. |
} | ||
await delay(this.waitBetweenTries) | ||
adjustments = await this.adjustmentsService.findByPersonOutsideSentenceEnvelope(nomsId, token) | ||
// Try again | ||
} else { | ||
// Unable to calculate unused deductions. | ||
return false | ||
return 'NONE' |
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.
This is where the calculated unused deductions don't match whats in the database. There isn't really a message for this.
} | ||
} | ||
} catch { | ||
// Error couldn't calculate unused deductions. | ||
} | ||
return false | ||
return 'NONE' |
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.
This is where there was an exception somewhere. Not sure it should be 'NONE'
I think in the couple of examples where we shouldn't return NONE we should default to the old message. |
try { | ||
let adjustments = await this.adjustmentsService.findByPersonOutsideSentenceEnvelope(nomsId, token) | ||
|
||
const deductions = adjustments.filter(it => it.adjustmentType === 'REMAND' || it.adjustmentType === 'TAGGED_BAIL') | ||
if (!deductions.length) { | ||
// If there are no deductions then unused deductions doesn't need to be calculated | ||
return true | ||
return 'NONE' | ||
} | ||
if (this.anyDeductionFromNomis(deductions)) { |
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.
This was meant to move to after the validation check
try { | ||
const deductions = adjustments.filter(it => it.adjustmentType === 'REMAND' || it.adjustmentType === 'TAGGED_BAIL') | ||
if (!deductions.length) { | ||
// If there are no deductions then unused deductions doesn't need to be calculated | ||
return true | ||
return 'NONE' | ||
} | ||
if (this.anyDeductionFromNomis(deductions)) { |
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.
This was meant to move to after the validation check
} | ||
const calculatedUnusedDeducions = unusedDeductionsResponse.unusedDeductions | ||
|
||
const deductions = adjustments.filter(it => it.adjustmentType === 'REMAND' || it.adjustmentType === 'TAGGED_BAIL') | ||
if (!deductions.length) { |
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.
This bit didn't need to move. Just the anyDeductionFromNomis
condition. Otherwise looks good.
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.
LGTM
No description provided.