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

[Waiting on Checklist completion] [$500] IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 #29048

Closed
5 of 6 tasks
izarutskaya opened this issue Oct 7, 2023 · 30 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 Weekly KSv2

Comments

@izarutskaya
Copy link

izarutskaya commented Oct 7, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open https://staging.new.expensify.com/

  2. Log in with any account

  3. Click on the FAB button

  4. Click on 'Request Money'

  5. Choose 'Manual' and add an amount

  6. Click on the 'Next' button

  7. Select any user

  8. Save money request

  9. Repeat steps 3-8

  10. Switch to offline mode

  11. Delete the first created IOU

Expected Result:

When deleting a money request offline, the IOU skeleton should cross out the requested amount (or specify 0.00 but with the requested currency) and at the moment of going online delete the request

Actual Result:

When deleting a money request offline, the IOU skeleton changes the currency to $0.00

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.79-3

Reproducible in staging?: Y

Reproducible in production?: Y

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug6228474_1696661550430.Recording__452.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause-Internal Team

Slack conversation: @

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018493886c3c932b5c
  • Upwork Job ID: 1710589907968835584
  • Last Price Increase: 2023-10-14
  • Automatic offers:
    • ZhenjaHorbach | Contributor | 27285268
Issue OwnerCurrent Issue Owner: @rushatgabhane
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 7, 2023

Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot changed the title All - IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 [$500] All - IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 Oct 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 7, 2023

Job added to Upwork: https://www.upwork.com/jobs/~018493886c3c932b5c

@melvin-bot
Copy link

melvin-bot bot commented Oct 7, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 7, 2023

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

@abdel-h66
Copy link
Contributor

abdel-h66 commented Oct 7, 2023

Proposal

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

IOU skeleton changes the currency to default $

What is the root cause of that problem?

When the money request is deleted all of its data is removed, when trying to find it in Onyx we will get an empty object

        transaction: {
            key: ({action}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${(action && action.originalMessage && action.originalMessage.IOUTransactionID) || 0}`,
        },

And the to display the currency in the skeleton we use

return CurrencyUtils.convertToDisplayString(TransactionUtils.getAmount(props.transaction), props.transaction.currency);
And this in turn will not find the original currency of the request. which fallbacks to $

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

We luckily still have the currency in the original message of the action that we can use a fall back when the transaction is no longer there.

We can update the getdisplayAmountText function to use the fallback for this situation as such

return CurrencyUtils.convertToDisplayString(TransactionUtils.getAmount(props.transaction), props.transaction.currency || (props.action && props.action.originalMessage && props.action.originalMessage.currency));

image

Extra findings

As you can see the same issue would happen to the distance request display, we can refactor that part of the function too to use the fallback

const getDisplayAmountText = () => {
if (isDistanceRequest) {
return CurrencyUtils.convertToDisplayString(TransactionUtils.getAmount(props.transaction), props.transaction.currency);
}
if (isScanning) {
return props.translate('iou.receiptScanning');
}
return CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency);
};

What alternative solutions did you explore? (Optional)

N/A

@ZhenjaHorbach
Copy link
Contributor

Proposal

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

When deleting a money request offline, the IOU skeleton changes Default value($0.00)

What is the root cause of that problem?

After deleting the request in offline mode, we delete IOUTransactionID which we use to get transaction info

key: ({action}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${(action && action.originalMessage && action.originalMessage.IOUTransactionID) || 0}`,

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

I think that we can create a special variable that will allow us to obtain information about the status of the request

For this we can use pendingAction from action

const isDeleted = lodashGet(props.action, 'pendingAction', null) === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;

And when isDeleted will true we will call getDisplayDeleteAmountText() instead getDisplayAmountText()

{isDeleted ? getDisplayDeleteAmountText() : getDisplayAmountText()}

    const getDisplayDeleteAmountText = () => {
        const {amount, currency} = ReportUtils.getTransactionDetails(props.action.originalMessage);

        if (isDistanceRequest) {
            return CurrencyUtils.convertToDisplayString(TransactionUtils.getAmount(props.action.originalMessage), currency);
        }

        if (isScanning) {
            return props.translate('iou.receiptScanning');
        }

        return CurrencyUtils.convertToDisplayString(amount, currency);
    };

Screenshot 2023-10-07 at 12 53 34

And if we need cross-out text
We can add isDeleted && {textDecorationLine: 'line-through'} for text

What alternative solutions did you explore? (Optional)

If we need to zero amount and transmit currency
we can update the getDisplayDeleteAmountText :

CurrencyUtils.convertToDisplayString(0, currency);

And delete line-through

@sadiamehreen
Copy link

Proposal
Please re-state the problem that we are trying to solve in this issue.
On confirming the delete request money item could not be deleted and is set to $0 when the app is offline

What is the root cause of that problem?
On delete confirmation the app calls the POST endpoint http://localhost:8082/api?command=DeleteMoneyRequest, and when the app is online it works fine but when offline the POST request is not made due to which the output is different as the code logic is same for offline and online delete request
online_call

What changes do you think we should make in order to solve the problem?
We need to handle the offline and online calls differently. We can delete the request from the state when the app is offline so that it doesn't show on the list of money requests. Right now the same confirmDeleteAndHideModal function is called in both online and offline state of the app.
confirm_modal

Extra findings
The DeleteMoneyRequest API is called when the app is back online and the request is being removed from the list but it stays there until the app is offline

What alternative solutions did you explore? (Optional)
N/A

@melvin-bot
Copy link

melvin-bot bot commented Oct 7, 2023

📣 @sadiamehreen! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@sadiamehreen
Copy link

Contributor details
Your Expensify account email: sadiamehreen204@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01ac9eecb4485268f6

@melvin-bot
Copy link

melvin-bot bot commented Oct 7, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@shubham1206agra
Copy link
Contributor

Similar RCA to #27058

@melvin-bot melvin-bot bot added the Overdue label Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2023

@twisterdotcom, @rushatgabhane Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot
Copy link

melvin-bot bot commented Oct 12, 2023

@twisterdotcom, @rushatgabhane Eep! 4 days overdue now. Issues have feelings too...

@twisterdotcom
Copy link
Contributor

@rushatgabhane let's have a review of these proposals when you can.

@melvin-bot melvin-bot bot removed the Overdue label Oct 12, 2023
@izarutskaya izarutskaya changed the title [$500] All - IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 [$500] IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 14, 2023

📣 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 added the Overdue label Oct 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

@twisterdotcom, @rushatgabhane Whoops! This issue is 2 days overdue. Let's get this updated quick!

@twisterdotcom
Copy link
Contributor

Bump @rushatgabhane

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
@rushatgabhane
Copy link
Member

rushatgabhane commented Oct 17, 2023

C+ reviewed 🎀 👀 🎀

I like @ZhenjaHorbach's proposal to treat deleted request as a pending action #29048 (comment)

@melvin-bot
Copy link

melvin-bot bot commented Oct 19, 2023

📣 @ZhenjaHorbach 🎉 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 📖

@ZhenjaHorbach
Copy link
Contributor

📣 @ZhenjaHorbach 🎉 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 📖

PR will be ready tomorrow

@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @ZhenjaHorbach got assigned: 2023-10-19 21:26:46 Z
  • when the PR got merged: 2023-10-25 19:36:32 UTC
  • days elapsed: 3

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 30, 2023
@melvin-bot melvin-bot bot changed the title [$500] IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 [HOLD for payment 2023-11-06] [$500] IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 Oct 30, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.92-4 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 2023-11-06. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

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:

  • [@rushatgabhane] The PR that introduced the bug has been identified. Link to the PR:
  • [@rushatgabhane] 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:
  • [@rushatgabhane] 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:
  • [@rushatgabhane] Determine if we should create a regression test for this bug.
  • [@rushatgabhane] 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] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Nov 5, 2023
@twisterdotcom
Copy link
Contributor

Payment summary:

@rushatgabhane should request $500 via Manual Requests
@ZhenjaHorbach paid $500 here

Waiting on Checklist from @rushatgabhane

@melvin-bot melvin-bot bot removed the Overdue label Nov 7, 2023
@twisterdotcom twisterdotcom added Weekly KSv2 and removed Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 labels Nov 7, 2023
@twisterdotcom twisterdotcom changed the title [HOLD for payment 2023-11-06] [$500] IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 [Waiting on Checklist completion] [$500] IOU - When deleting a money request offline, the IOU skeleton changes the currency to $0.00 Nov 7, 2023
@rushatgabhane
Copy link
Member

@rushatgabhane
Copy link
Member

rushatgabhane commented Nov 13, 2023

  1. The PR that introduced the bug has been identified. Link to the PR: Display receipts in chat #24235

  2. 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/24235/files#r1391999527

  3. 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: No

  4. Determine if we should create a regression test for this bug. No

  5. 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 - N.A.

@JmillsExpensify
Copy link

$500 payment approved for @rushatgabhane based on this comment.

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 Weekly KSv2
Projects
None yet
Development

No branches or pull requests

9 participants