[HOLD for payment 2024-12-07] [$250] [Dupe detection] Tax field does not show the "Default" label on the confirmation page
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.
- Go to staging.new.expensify.com
- Go to workspace chat.
- Submit two same distance expenses with the same distance rate that has tax rate and tax reclaimable on.
- Go to transaction thread of any submitted expense.
- Note that Tax field has the "Default" label.
- Click Review duplicates.
- Click Keep this on (any).
- 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
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 Owner
Current Issue Owner: @stephanieelliott
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.
We think that this bug might be related to #wave-control
@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
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 thetransactionID. https://github.com/Expensify/App/blob/73f97c930795b4c68512d0e25ee253f7ce7d4515/src/libs/TransactionUtils.ts#L748-L769 -
But when we call
buildNewTransactionAfterReviewingDuplicateson 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 theREVIEW_DUPLICATESONYX 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
updated the repro steps slightly -- actual result shows None instead of the expected default rate.
Job added to Upwork: https://www.upwork.com/jobs/~017284a9effe70faa8
Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov (External)
and another one! CC: @dylanexpensify @pecanoro @parasharrajat @kubabutkiewicz
@alitoshmatov Could you review the proposals when you have some time?
I can do that @pecanoro if needed.
Putting a HOLD here for now since it seems to be the same as https://github.com/Expensify/App/issues/47974
@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.
I still think we should wait since the proposals are really similar, and they will need to be updated accordingly.
@pecanoro, @stephanieelliott, @alitoshmatov Huh... This is 4 days overdue. Who can take care of this?
Still holding on https://github.com/Expensify/App/issues/47974
Still holding on https://github.com/Expensify/App/issues/47974
Still holding
Still holding on https://github.com/Expensify/App/issues/47974
Im not able to reproduce this anymore -- can anyone else repro?
@stephanieelliott, issue is still reproducible.
https://github.com/user-attachments/assets/cd6d5ba0-28ea-4d9e-9afc-f59777b4f7c5
Ok @Krishna2323 can you make any necessary updates to your proposal, then let us know when it's ready so @alitoshmatov can review?
Bump on the above @Krishna2323, did still want to work on this?
@stephanieelliott, I will update my proposal/test branch today.
Hey @Krishna2323 have you had a chance to update the proposal?
@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.
Hey @alitoshmatov can you review the updated proposal? https://github.com/Expensify/App/issues/47975#issuecomment-2308874978
Hey @alitoshmatov can you review the updated proposal? https://github.com/Expensify/App/issues/47975#issuecomment-2308874978
Bump @alitoshmatov
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@pecanoro, @stephanieelliott, @alitoshmatov Whoops! This issue is 2 days overdue. Let's get this updated quick!
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