-
Notifications
You must be signed in to change notification settings - Fork 24
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
PSP-8746 | GST is modifiable for periods #4227
PSP-8746 | GST is modifiable for periods #4227
Conversation
✅ No secrets were detected in the code. |
1 similar comment
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
if (values === true) { | ||
const gstDecimal = gstConstant !== undefined ? parseFloat(gstConstant.value) : undefined; | ||
const calculated = round((formikState.values.paymentAmount as number) * (gstDecimal / 100)); | ||
formikState.setFieldValue('gstAmount', calculated); | ||
} else { |
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.
There is a code path here where gstDecimal is undefined (when the GST constant is not defined).
I'm not sure what would be the result of line 81 would be in this case; ie: calculated = round(... * (undefined/100))
Would it make sense to put a check here for that case?
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.
fair point. I added a better default value
if (values === true) { | ||
const gstDecimal = gstConstant !== undefined ? parseFloat(gstConstant.value) : undefined; | ||
const calculated = round( | ||
(getIn(formikProps.values, paymentAmountField) as number) * (gstDecimal / 100), | ||
); |
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.
same comment here re: gstDecimal being undefined
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.
same as above
✅ No secrets were detected in the code. |
No description provided.