Repository navigation
[HOLD for payment 2024-07-10] [$250] [Track tax] Disabled tax rate can be selected #43613
Description
Activity
- addedDailyKSv2KSv2BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on Jun 12, 2024 Triggered auto assignment to @stephanieelliott (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.@stephanieelliott 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
We think that this bug might be related to #wave-collect - Release 2
Proposal
Please re-state the problem that we are trying to solve in this issue.
Track tax - Disabled tax rate can be selected
What is the root cause of that problem?
Tax rates are not filtered based on the enabled state.
App/src/pages/workspace/distanceRates/PolicyDistanceRateTaxRateEditPage.tsx
Lines 39 to 51 in d0b3552
const taxRateItems: ListItemType[] = useMemo(() => { const taxes = policy?.taxRates?.taxes; const result = Object.entries(taxes ?? {}).map(([key, value]) => ({ value: key, text: `${value.name} (${value.value})`, isSelected: taxRateExternalID === key, keyForList: key, pendingAction: value.pendingAction, isDisabled: value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, })); return result; }, [policy, taxRateExternalID]); What changes do you think we should make in order to solve the problem?
Filter out disabled tax rates using
isDisabledproperty.const taxRateItems: ListItemType[] = useMemo( () => Object.entries(policy?.taxRates?.taxes ?? {}) .filter(([, value]) => !value.isDisabled) .map(([key, value]) => ({ value: key, text: `${value.name} (${value.value})`, isSelected: taxRateExternalID === key, keyForList: key, pendingAction: value.pendingAction, isDisabled: value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, })), [policy, taxRateExternalID], );
What alternative solutions did you explore? (Optional)
We can disable the option instead of filtering, in that case we just need to modify the
isDisabledproperty.isDisabled: value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || value.isDisabled,
What alternative solutions did you explore? (Optional 2)
We can use
TaxPickercomponent instead ofSelectionListlike we do inWorkspaceTaxesSettingsForeignCurrency.
{({insets}) => ( <> <HeaderWithBackButton title={translate('workspace.taxes.foreignDefault')} /> <View style={[styles.mb4, styles.flex1]}> <TaxPicker selectedTaxRate={selectedTaxRate} policyID={policyID} insets={insets} onSubmit={submit} /> </View> </> )} - addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributor
on Jun 14, 2024 Job added to Upwork: https://www.upwork.com/jobs/~01b142f41c7ec7f0fd
- changed the title
[-] Track tax - Disabled tax rate can be selected[/-][+][$250] Track tax - Disabled tax rate can be selected[/+]on Jun 14, 2024 - addedHelp WantedApply this label when an issue is open to proposals by contributorsApply this label when an issue is open to proposals by contributors
on Jun 14, 2024 Triggered auto assignment to Contributor-plus team member for initial proposal review - @hungvu193 (
External)Proposal
Please re-state the problem that we are trying to solve in this issue.
Track tax - Disabled tax rate can be selected
What is the root cause of that problem?
In PolicyDistanceRateTaxRateEditPage.tsx, we refrain from utilizing TaxPicker, which includes the logic to exclude disabled rates
What changes do you think we should make in order to solve the problem?
In PolicyDistanceRateTaxRateEditPage.tsx, it's advisable to reuse TaxPicker
<TaxPicker selectedTaxRate={selectedTaxRate} policyID={policyID} insets={insets} onSubmit={onTaxRateChange} />We should also hide the selected tax rate if it's disabled (This will require updates in the WORKSPACE_DISTANCE_RATE_DETAILS page, which will be detailed in the pull request)
const taxRateExternal = Object.values(TransactionUtils.transformedTaxRates(policy)).find((taxRate) => taxRate.code === taxRateExternalID); const selectedTaxRate = taxRateExternal?.isDisabled ? '' : TransactionUtils.getWorkspaceTaxesSettingsName(policy, taxRateExternalID);We need to update onTaxRateChange function and eliminate any unused elements.
const onTaxRateChange = (newTaxRate: OptionsListUtils.TaxRatesOption) => { if (taxRateExternalID === newTaxRate.code) { Navigation.goBack(); return; } DistanceRate.updateDistanceTaxRate(policyID, customUnit, [ { ...rate, attributes: { ...rate.attributes, taxRateExternalID: newTaxRate.code, }, }, ]); Navigation.navigate(ROUTES.WORKSPACE_DISTANCE_RATE_DETAILS.getRoute(policyID, rateID)); };With this approach, after this PR is merged, we need to incorporate the onDismiss function and eliminate the existing logic to check duplicated tax in onTaxRateChange function
What alternative solutions did you explore? (Optional)
31 remaining items
- addedWeeklyKSv2KSv2Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to production
on Jul 3, 2024 - changed the title
[-][$250] [Track tax] Disabled tax rate can be selected[/-][+][HOLD for payment 2024-07-10] [$250] [Track tax] Disabled tax rate can be selected[/+]on Jul 3, 2024 Reviewinglabel has been removed, please complete the "BugZero Checklist".The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.3-7 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-07-10. 🎊
For reference, here are some details about the assignees on this issue:
- @hungvu193 requires payment automatic offer (Reviewer)
- @Krishna2323 requires payment automatic offer (Contributor)
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:
- [@hungvu193] The PR that introduced the bug has been identified. Link to the PR:
- [@hungvu193] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
- [@hungvu193] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
- [@hungvu193] Determine if we should create a regression test for this bug.
- [@hungvu193] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
- [@twisterdotcom / @stephanieelliott] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
Hey @hungvu193 can you complete the NZ checklist please?
Summarizing payment on this issue:
- Contributor: @Krishna2323 $250 via Upwork PAID
- Contributor+: @hungvu193 $250 via Upwork PAID
Upwork job is here: https://www.upwork.com/jobs/~01b142f41c7ec7f0fd
- The PR that introduced the bug has been identified. Link to the PR: Feature: Add the ability to configure tax rates on distance rates #42141
- The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: https://github.com/Expensify/App/pull/42141/files#r1673377848
- A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N/A
- Determine if we should create a regression test for this bug: No
This is new feature and was recently added so I don't think we need regression test for this one.
Reacted by Stephanie Elliott- moved this from Polish to Done in [#whatsnext] #wave-collect
on Jul 11, 2024
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.82-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4623265
Issue reported by: Applause - Internal Team
Action Performed:
Precondition:
Expected Result:
In Step 6, app should prevent the disabled tax rate to be selected, which is the Old Dot behavior
Actual Result:
In Step 6, app allows the disabled tax rate to be selected
After submitting distance expense, it shows the "Tax no longer valid" violation
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6511235_1718218613507.20240613_025108.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @twisterdotcom / @stephanieelliott