-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[HOLD for payment 2024-10-25] [$250] [P2P Distance] Distance rate - Error when selecting distance rate that no longer has tax rate #47613
Comments
Triggered auto assignment to @OfstadC ( |
We think that this bug might be related to #wave-collect - Release 1 |
@OfstadC FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
ProposalPlease re-state the problem that we are trying to solve in this issue.App throws error when selecting a distance rate that no longer has tax rate. The problem also happens when the linked tax rate is disabled. What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?We should:
the distance rate with deleted tax rate in distance rate selector. First, modify the Secondly, we need to know whether its corresponding tax rate is deleted or disabled by const taxRate = PolicyUtils.getTaxByID(rate.attributes.taxRateExternalID);
const isTaxRateAvailable = taxRate && !taxRate.isDisabled; Then:
disabled: PolicyUtils.isTaxTrackingEnabled && !isTaxRateAvailable |
I feel like it should show an error, no? Going to discuss in Slack. |
@trjExpensify Could you confirm expected behavior here? I don't have the tax option on Distance rates in NewDot 🤔 |
Commented in thread! |
Adding @MonilBhavsar here per the thread. |
On NewDot in the workspace settings, I propose this change to make it clearer that the
Note: This would be similar to how we show certain fields in settings after a selection that comes before it, i.e monthly for scheduled submit reveals a Date field etc).
Note: This would prevent an “unexpected error” from occurring, as you can’t get into a situation where there’s a Tax reclaimable on value without a Tax rate selected. |
@daledah if you want to update your proposal based on this^ |
Edited by proposal-police: This proposal was edited at 2024-08-19T10:00:00Z. Updated ProposalPlease re-state the problem that we are trying to solve in this issue.App throws error when selecting a distance rate that no longer has tax rate. The problem also happens when the linked tax rate is disabled. What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
Add the condition of having a tax rate selected here:
isDistanceTrackTaxEnabled && !!taxRate
We need to update the BE to handle this and implement optimistic data in the FE. In const customUnits = policy?.customUnits ?? {};
const ratesToUpdate = Object.values(customUnits?.[Object.keys(customUnits)[0]]?.rates).filter((rate) => !!rate.attributes?.taxRateExternalID && taxesToDelete.includes(rate.attributes?.taxRateExternalID)); Then if there are, build the onyx data to clear the tax rate and value from the corresponding distance rate: const optimisticRates: Record<string, Rate> = {};
const successRates: Record<string, Rate> = {};
const failureRates: Record<string, Rate> = {};
ratesToUpdate.forEach((rate) => {
const rateID = rate.customUnitRateID ?? '';
optimisticRates[rateID] = {
...rate,
attributes: {
...rate?.attributes,
taxRateExternalID: undefined,
taxClaimablePercentage: undefined,
},
pendingFields: {
taxRateExternalID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
taxClaimablePercentage: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
};
successRates[rateID] = {...rate, pendingFields: {taxRateExternalID: null}};
failureRates[rateID] = {
...rate,
pendingFields: {taxRateExternalID: null, taxClaimablePercentage: null},
errorFields: {
taxRateExternalID: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage'),
taxClaimablePercentage: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage'),
},
};
}); And use them inside |
Job added to Upwork: https://www.upwork.com/jobs/~01def12cd4fe837196 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann ( |
@DylanDylann could you please take a look at the proposal based on this expected outcome #47613 (comment) |
Current assignee @MonilBhavsar is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new. |
@DylanDylann PR is up. |
This issue has not been updated in over 15 days. @OfstadC, @MonilBhavsar, @DylanDylann, @daledah eroding to Monthly issue. P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do! |
Update: Waiting for BE change from @MonilBhavsar |
Submitted PR for review. It is expected to be live on staging early next week |
App PR is merged! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.50-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-10-25. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@DylanDylann Could you please complete the BZ checklist? Thanks! 😃 |
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed: [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA Regression Test Proposal
Do we agree 👍 or 👎 |
Payment Summary
|
@OfstadC Done |
Paid - closing issue. Thanks everyone! |
@OfstadC @MonilBhavsar Be sure to fill out the Contact List! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: v9.0.21-3
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Action Performed:
Precondition:
Expected Result:
App will not throw error when selecting a distance rate that no longer has tax rate (tax rate is deleted after it is assigned to distance rate).
Actual Result:
App throws error when selecting a distance rate that no longer has tax rate.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6575129_1723970878058.20240818_164022.mp4
#47613 (comment)
On NewDot in the workspace settings, I propose this change to make it clearer that the Tax rate and Tax reclaimable on set on a distance rate are interlinked:
Don’t show the Tax reclaimable on field until a Tax rate is selected.
Note: This would be similar to how we show certain fields in settings after a selection that comes before it, i.e monthly for scheduled submit reveals a Date field etc).
If the Tax rate being used on the distance rate is deleted in Taxes, clear both the Tax rate and Tax reclaimable on values. We would then also hide the Tax reclaimable on field again as Tax rate is empty.
Note: This would prevent an “unexpected error” from occurring, as you can’t get into a situation where there’s a Tax reclaimable on value without a Tax rate selected.
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @OfstadCThe text was updated successfully, but these errors were encountered: