App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2024-12-07] [$250] [Dupe detection] Tax field does not show the "Default" label on the confirmation page

Open IuliiaHerets opened this issue 1 year ago • 43 comments

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.24-1 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:

  • Track tax is enabled in Workspace settings > Distance rates > Settings.
  • Distance rate has Tax rate and Tax reclaimable fields populated.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit two same distance expenses with the same distance rate that has tax rate and tax reclaimable on.
  4. Go to transaction thread of any submitted expense.
  5. Note that Tax field has the "Default" label.
  6. Click Review duplicates.
  7. Click Keep this on (any).
  8. Proceed to confirmation page.

Expected Result:

Tax field will show the "Default" label on the confirmation page.

Actual Result:

Tax field does not show the "Default" label on the confirmation page and instead shows "None"

Workaround:

Unknown

Platforms:

  • [x] Android: Native
  • [x] Android: mWeb Chrome
  • [x] iOS: Native
  • [x] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/ea6e4514-e527-4b48-9f17-21a88c6c7d21

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017284a9effe70faa8
  • Upwork Job ID: 1828590697351581643
  • Last Price Increase: 2024-11-13
  • Automatic offers:
    • Krishna2323 | Contributor | 104974640
Issue OwnerCurrent Issue Owner: @stephanieelliott

IuliiaHerets avatar Aug 24 '24 22:08 IuliiaHerets

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.

melvin-bot[bot] avatar Aug 24 '24 22:08 melvin-bot[bot]

We think that this bug might be related to #wave-control

IuliiaHerets avatar Aug 24 '24 22:08 IuliiaHerets

@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

IuliiaHerets avatar Aug 24 '24 22:08 IuliiaHerets

Proposal

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

Dupe detect - Tax field does not show the "Default" label on the confirmation page

What is the root cause of that problem?

  • To get the default tax rate we need comment?.customUnit?.customUnitRateID?.toString(); in the transactionID. https://github.com/Expensify/App/blob/73f97c930795b4c68512d0e25ee253f7ce7d4515/src/libs/TransactionUtils.ts#L748-L769

  • But when we call buildNewTransactionAfterReviewingDuplicates on confirmation page the comment object is only left with a comment property, all other properties are removed. https://github.com/Expensify/App/blob/73f97c930795b4c68512d0e25ee253f7ce7d4515/src/libs/TransactionUtils.ts#L952-L963

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

When we modify the transaction, we need to store the remaining properties of the comment object. To do this we need to make few changes.

  • We first need to store the comment object in keep object. https://github.com/Expensify/App/blob/0c8455280c738a5db596f34409a0a3177e682e7f/src/libs/TransactionUtils/index.ts#L991-L993
                if (allCommentsAreEqual || allCommentsAreEmpty) {
                    keep[fieldName] = firstTransaction?.comment?.comment ?? firstTransaction?.comment;
                    keep.comment = firstTransaction?.comment;
  • In buildNewTransactionAfterReviewingDuplicates, we need to merge the remaining properties of the comment object. https://github.com/Expensify/App/blob/0c8455280c738a5db596f34409a0a3177e682e7f/src/libs/TransactionUtils/index.ts#L1030
comment: {...reviewDuplicateTransaction?.comment, comment: reviewDuplicateTransaction?.description},
  • When updating the description in ReviewDescription, we need to find the correct comment object and update it in the REVIEW_DUPLICATES ONYX object. https://github.com/Expensify/App/blob/0c8455280c738a5db596f34409a0a3177e682e7f/src/pages/TransactionDuplicate/ReviewDescription.tsx#L34-L39
            const comment = compareResult.change.description?.find((d) => d?.comment === data.value);
            setReviewDuplicatesKey({description: data.value, comment});

Test Branch

What alternative solutions did you explore? (Optional)


Alternatively we can store the comment object with updated comment instead of description text:

https://github.com/Expensify/App/blob/0c8455280c738a5db596f34409a0a3177e682e7f/src/libs/TransactionUtils/index.ts#L987-L992

NOTE: We also need to make changes in few other files. The changes are bit similar to solution above. Please checkout the text branch below for a better understanding.

Test Branch - Alternative Solution

Result

https://github.com/user-attachments/assets/2d8a009f-9b87-4cb3-a560-923d3882ae6d

Krishna2323 avatar Aug 25 '24 14:08 Krishna2323

updated the repro steps slightly -- actual result shows None instead of the expected default rate.

stephanieelliott avatar Aug 28 '24 00:08 stephanieelliott

Job added to Upwork: https://www.upwork.com/jobs/~017284a9effe70faa8

melvin-bot[bot] avatar Aug 28 '24 00:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 28 '24 00:08 melvin-bot[bot]

and another one! CC: @dylanexpensify @pecanoro @parasharrajat @kubabutkiewicz

trjExpensify avatar Aug 28 '24 00:08 trjExpensify

@alitoshmatov Could you review the proposals when you have some time?

pecanoro avatar Aug 29 '24 08:08 pecanoro

I can do that @pecanoro if needed.

parasharrajat avatar Aug 29 '24 10:08 parasharrajat

Putting a HOLD here for now since it seems to be the same as https://github.com/Expensify/App/issues/47974

pecanoro avatar Aug 29 '24 12:08 pecanoro

@pecanoro, I have proposals for both issues, and I can assure you that they are different. In this issue, we aren't persisting all the properties of the comment object, whereas in issue #47974, the comparison of the comment.comment string is incorrect.

I think we can remove the hold.

Krishna2323 avatar Aug 29 '24 20:08 Krishna2323

I still think we should wait since the proposals are really similar, and they will need to be updated accordingly.

pecanoro avatar Aug 30 '24 09:08 pecanoro

@pecanoro, @stephanieelliott, @alitoshmatov Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Sep 02 '24 18:09 melvin-bot[bot]

Still holding on https://github.com/Expensify/App/issues/47974

stephanieelliott avatar Sep 11 '24 02:09 stephanieelliott

Still holding on https://github.com/Expensify/App/issues/47974

stephanieelliott avatar Sep 17 '24 02:09 stephanieelliott

Still holding

pecanoro avatar Sep 17 '24 15:09 pecanoro

Still holding on https://github.com/Expensify/App/issues/47974

stephanieelliott avatar Sep 25 '24 19:09 stephanieelliott

Im not able to reproduce this anymore -- can anyone else repro?

stephanieelliott avatar Oct 03 '24 23:10 stephanieelliott

@stephanieelliott, issue is still reproducible.

https://github.com/user-attachments/assets/cd6d5ba0-28ea-4d9e-9afc-f59777b4f7c5

Krishna2323 avatar Oct 04 '24 03:10 Krishna2323

Ok @Krishna2323 can you make any necessary updates to your proposal, then let us know when it's ready so @alitoshmatov can review?

stephanieelliott avatar Oct 09 '24 00:10 stephanieelliott

Bump on the above @Krishna2323, did still want to work on this?

stephanieelliott avatar Oct 11 '24 04:10 stephanieelliott

@stephanieelliott, I will update my proposal/test branch today.

Krishna2323 avatar Oct 11 '24 15:10 Krishna2323

Hey @Krishna2323 have you had a chance to update the proposal?

stephanieelliott avatar Oct 16 '24 06:10 stephanieelliott

@stephanieelliott sorry for the delay, I have updated the main solution's test branch. @alitoshmatov can start reviewing.

@alitoshmatov Let me know if you need a test branch for alternative solution too.

Krishna2323 avatar Oct 17 '24 13:10 Krishna2323

Hey @alitoshmatov can you review the updated proposal? https://github.com/Expensify/App/issues/47975#issuecomment-2308874978

stephanieelliott avatar Oct 22 '24 07:10 stephanieelliott

Hey @alitoshmatov can you review the updated proposal? https://github.com/Expensify/App/issues/47975#issuecomment-2308874978

Bump @alitoshmatov

stephanieelliott avatar Oct 26 '24 01:10 stephanieelliott

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

melvin-bot[bot] avatar Oct 26 '24 16:10 melvin-bot[bot]

@pecanoro, @stephanieelliott, @alitoshmatov Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Oct 29 '24 18:10 melvin-bot[bot]

I am going to add the HOLD again until this one is merged since it will likely create conflicts: https://github.com/Expensify/App/pull/48958

pecanoro avatar Oct 29 '24 18:10 pecanoro