Skip to content
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-09-09][$250] Track tax - Track tax feature is still available when Taxes feature is disabled offline #47421

Closed
6 tasks done
lanitochka17 opened this issue Aug 14, 2024 · 18 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 14, 2024

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: 9.0.20-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: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > More features
  3. Enable Distance rates and Taxes
  4. Go to Distance rates > Settings
  5. Enable Track tax
  6. Go offline
  7. Disable Taxes in More features
  8. Go to Distance rates > Settings
  9. Note that Track tax switch is still enabled but locked
  10. Click on any distance rate
  11. Note that Tax rate and Tax reclaimable on fields are still present when Taxes is disabled

Expected Result:

When disabling Taxes feature offline
Step 9 - Track tax switch should be disabled and locked
Step 11 - Tax rate and Tax reclaimable on fields should disappear

Actual Result:

When disabling Taxes feature offline
Step 9 - Track tax switch is enabled and locked
Step 11 - Tax rate and Tax reclaimable on fields are still present

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6571862_1723628522366.20240814_173557.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0125dfa57845b9c94e
  • Upwork Job ID: 1823746280169788016
  • Last Price Increase: 2024-08-21
  • Automatic offers:
    • etCoderDysto | Contributor | 103626049
Issue OwnerCurrent Issue Owner: @Ollyws
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 14, 2024
Copy link

melvin-bot bot commented Aug 14, 2024

Triggered auto assignment to @lschurr (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.

@lanitochka17
Copy link
Author

@lschurr 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

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 2

@etCoderDysto
Copy link
Contributor

etCoderDysto commented Aug 14, 2024

Edited by proposal-police: This proposal was edited at 2024-08-14 13:28:19 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Track tax feature is still available when Taxes feature is disabled offline

What is the root cause of that problem?

We are using isDistanceTrackTaxEnabled to determine if we should display tax features for

When user disable tax rate in offline mode, we are not optimistialy updating isDistanceTrackTaxEnabled (policy?.customUnits.customUnitID.customUnit?.attributes?.taxEnabled) to false as we do for isPolicyTrackTaxEnabled (policy?.tax?.trackingEnabled)

What changes do you think we should make in order to solve the problem?

We should check also for isPolicyTrackTaxEnabled in the above places where we are using isDistanceTrackTaxEnabled, since isPolicyTrackTaxEnabled updated optimistically.

 <Switch
     isOn={isDistanceTrackTaxEnabled && isPolicyTrackTaxEnabled}

We will do the same for tax rates, and tax reclaimable as well

What alternative solutions did you explore? (Optional)

We can optimistially update isDistanceTrackTaxEnabled (policy?.customUnits.customUnitID.customUnit?.attributes?.taxEnabled) to false (enabled) in optimistic data, and to true (!enalbled) in failure data here

Some more details about creating optimistic customUnits data
    const policy = getPolicy(policyID);
    const shouldAddDefaultTaxRatesData = (!policy?.taxRates || isEmptyObject(policy.taxRates)) && enabled;
    const customUnits = policy?.customUnits ?? {};
    const customUnit = customUnits[Object.keys(customUnits)[0]];
    const customUnitID = customUnit?.customUnitID ?? '';
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
            value: {
                customUnits: {
                    [customUnitID]: {
                        ...customUnit,
                        attributes: {
                            ...customUnit.attributes,
                            taxEnabled: customUnit.attributes.taxEnabled ? enabled : customUnit.attributes.taxEnabled,
                        },
                    },
                },
                tax: {
                    trackingEnabled: enabled,

We check for customUnit.attributes.taxEnabled to prevent assigning true to isDistanceTrackTaxEnabled and enabling Track Tax feature when the user enables tax rate on more features page but didn't enable Track Tax on DistanceRatesSettings page

@lschurr lschurr added Reviewing Has a PR in review External Added to denote the issue can be worked on by a contributor and removed Reviewing Has a PR in review labels Aug 14, 2024
@melvin-bot melvin-bot bot changed the title Track tax - Track tax feature is still available when Taxes feature is disabled offline [$250] Track tax - Track tax feature is still available when Taxes feature is disabled offline Aug 14, 2024
Copy link

melvin-bot bot commented Aug 14, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0125dfa57845b9c94e

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 14, 2024
Copy link

melvin-bot bot commented Aug 14, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External)

@Ollyws
Copy link
Contributor

Ollyws commented Aug 15, 2024

As taxes must be enabled on the policy in order to enable tax tracking on distance rates @etCoderDysto's proposal LGTM.
🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 15, 2024

Triggered auto assignment to @mountiny, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Aug 20, 2024

@Ollyws, @lschurr, @mountiny Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Aug 20, 2024
@lschurr
Copy link
Contributor

lschurr commented Aug 20, 2024

@mountiny - looks like we just need a quick check from you. Can I assign this over to @etCoderDysto?

Copy link

melvin-bot bot commented Aug 21, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 21, 2024
@mountiny
Copy link
Contributor

Assigned, thanks for your patience

Copy link

melvin-bot bot commented Aug 21, 2024

📣 @etCoderDysto 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Aug 26, 2024
@etCoderDysto
Copy link
Contributor

@Ollyws PR is ready for review

@Ollyws
Copy link
Contributor

Ollyws commented Sep 8, 2024

Due for payment tomorrow @lschurr, Thanks!

@lschurr lschurr changed the title [$250] Track tax - Track tax feature is still available when Taxes feature is disabled offline [Hold for payment 2024-09-09][$250] Track tax - Track tax feature is still available when Taxes feature is disabled offline Sep 9, 2024
@lschurr
Copy link
Contributor

lschurr commented Sep 9, 2024

Payment summary:

@lschurr lschurr closed this as completed Sep 9, 2024
@github-project-automation github-project-automation bot moved this from Polish to Done in [#whatsnext] #wave-collect Sep 9, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Sep 9, 2024

Requested on ND.

@garrettmknight
Copy link
Contributor

$250 approved for @Ollyws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
No open projects
Status: Done
Development

No branches or pull requests

6 participants