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 2023-10-23] [HOLD for payment 2023-10-23] [$500] Request money - Description briefly displayed in preview after adding a receipt from a manual request #28380

Closed
4 of 6 tasks
izarutskaya opened this issue Sep 28, 2023 · 46 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Sep 28, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open a chat.
  2. Navigate to the "" option.
  3. Enter the desired amount and click "Next"
  4. Click on the three dots menu and select "Add receipt" and select a file
  5. Enter a description and save it.
  6. Now send the request.

Expected Result:

The description should either be removed from the preview or not displayed at all

Actual Result:

The description is briefly displayed in the preview when adding a receipt from a manual request

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: v1.3.74-2

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

screen-recording-2023-09-25-at-110935-pm_hGxh7ohP.mp4
20230927_202141.mp4
Screen.Recording.2023-09-26.at.12.09.28.AM.mov
Screen.Recording.2023-09-26.at.12.05.01.AM.mov
20230926000212.mp4

Expensify/Expensify Issue URL:

Issue reported by: @ayazhussain79

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695666475040319

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a6766bd5a43af155
  • Upwork Job ID: 1707332794345508864
  • Last Price Increase: 2023-10-13
  • Automatic offers:
    • situchan | Contributor | 27104418
    • s-alves10 | Contributor | 27104428
Issue OwnerCurrent Issue Owner: @peterdbarkerUK
Issue OwnerCurrent Issue Owner: @peterdbarkerUK
@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 Sep 28, 2023
@melvin-bot melvin-bot bot changed the title Request money - Description briefly displayed in preview after adding a receipt from a manual request [$500] Request money - Description briefly displayed in preview after adding a receipt from a manual request Sep 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 28, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 28, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01a6766bd5a43af155

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

melvin-bot bot commented Sep 28, 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
Copy link

melvin-bot bot commented Sep 28, 2023

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

@ikevin127
Copy link
Contributor

ikevin127 commented Sep 28, 2023

Proposal

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

The description is briefly displayed in the preview when adding a receipt from a manual request.

What is the root cause of that problem?

The problem comes from the ReportPreview.js component:

{!isScanning && (numberOfRequests > 1 || hasReceipts) && (
    <View style={styles.flexRow}>
        <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
            <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>
                {previewSubtitle || moneyRequestComment} // <- HERE
            </Text>
        </View>
    </View>
)}

This code block is supposed to render the previewSubtitle label which can be the merchant if only one receipt requests exists or the number of requests count if more than one receipt requests exist.

The problem is the OR operator between these two variables previewSubtitle || moneyRequestComment, initially previewSubtitle is empty while the above-mentioned calculation is determined hence why the description shows up because moneyRequestComment is being shown while previewSubtitle is being determined.

This changes as soon as previewSubtitle is not empty anymore and is replaced by either the merchant if only one receipt requests exists or the number of requests count if more than one receipt requests exist.

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

I would create another component below the existing one where we will always render the request description like so:

{!isScanning && (numberOfRequests > 1 || hasReceipts) && (
    <View style={styles.flexRow}>
        <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
            <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>
                {previewSubtitle}
            </Text>
        </View>
    </View>
)}
+{moneyRequestComment && (
+   <View style={styles.flexRow}>
+       <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
+           <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>
+               {moneyRequestComment}
+           </Text>
+       </View>
+   </View>
)}

What alternative solutions did you explore? (Optional)

N/A

Videos

web.mp4

@s-alves10
Copy link
Contributor

Proposal

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

When adding a receipt from a manual request, description is displayed for a brief moment

What is the root cause of that problem?

{!isScanning && (numberOfRequests > 1 || hasReceipts) && (
<View style={styles.flexRow}>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>{previewSubtitle || moneyRequestComment}</Text>
</View>
</View>
)}

As you can see above, we show previewSubtitle or moneyRequestComment(description).

Looking at the previewSubtitle, we show merchant info if the IOU report has only one request and it has receipt, or we show the number of money requests.

const previewSubtitle = hasOnlyOneReceiptRequest
? TransactionUtils.getMerchant(transactionsWithReceipts[0])
: props.translate('iou.requestCount', {
count: numberOfRequests,
scanningReceipts: numberOfScanningReceipts,
});

The problem is in the value of merchant. When we add a receipt, we set merchant to empty

IOU.setMoneyRequestReceipt(filePath, file.name);

And when we create optimistic transaction, we also set merchant to empty

const defaultMerchant = _.isEmpty(receipt) ? CONST.TRANSACTION.DEFAULT_MERCHANT : '';

But when the API returns, it has merchant value: Request.
image

This inconsistency causes the description displayed for a brief moment

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

We need to make consistent the optimistic data and API returns.

Solution 1
We can set default merchant when building optimistic transaction here because we need to make the optimistic data consistent with API returns

const defaultMerchant = _.isEmpty(receipt) ? CONST.TRANSACTION.DEFAULT_MERCHANT : '';

    const defaultMerchant = CONST.TRANSACTION.DEFAULT_MERCHANT;

Solution 2
The backend should return empty merchant when receipt request with empty merchant is sent

Result
28380.mp4

What alternative solutions did you explore? (Optional)

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

melvin-bot bot commented Oct 3, 2023

@ntdiary, @peterdbarkerUK Eep! 4 days overdue now. Issues have feelings too...

@ntdiary
Copy link
Contributor

ntdiary commented Oct 3, 2023

Oh no, I missed this issue. I will ask on Slack if anyone has bandwidth to review this issue. 😔

@melvin-bot melvin-bot bot removed the Overdue label Oct 3, 2023
@situchan
Copy link
Contributor

situchan commented Oct 4, 2023

Taking this over based on @ntdiary's request

@melvin-bot
Copy link

melvin-bot bot commented Oct 5, 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 6, 2023
@peterdbarkerUK
Copy link
Contributor

sorry, I missed this due to travel at the weekend. BZ team review complete.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 6, 2023
@peterdbarkerUK
Copy link
Contributor

peterdbarkerUK commented Oct 9, 2023

@situchan - thanks for taking this on, what do you think of the current proposals?

@melvin-bot melvin-bot bot removed the Overdue label Oct 9, 2023
@situchan
Copy link
Contributor

situchan commented Oct 9, 2023

@s-alves10's proposal looks good to me.
I think we should go with Solution 1 which fixes optimistic data as sending Merchant value in backend seems intentional.
Assigned engineer will confirm this in backend logic.
🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

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

@situchan
Copy link
Contributor

situchan commented Oct 9, 2023

@peterdbarkerUK can you please assign me to this issue?

@melvin-bot melvin-bot bot added the Weekly KSv2 label Oct 16, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-23] [$500] Request money - Description briefly displayed in preview after adding a receipt from a manual request [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [$500] Request money - Description briefly displayed in preview after adding a receipt from a manual request Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 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-10-23. 🎊

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:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@peterdbarkerUK] 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 and removed Weekly KSv2 Daily KSv2 labels Oct 23, 2023
@peterdbarkerUK
Copy link
Contributor

Summarizing payouts for this issue:

Issue reporter: @ayazhussain79 $50 (offer sent)

Contributor: @s-alves10 $750 (inc urgency bonus)

Contributor+: @situchan $750 (inc urgency bonus) - please complete the BZ checklist and notify me here so that I can complete the payout.

Upwork Job

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

melvin-bot bot commented Oct 30, 2023

@bondydaa, @peterdbarkerUK, @situchan, @s-alves10 Huh... This is 4 days overdue. Who can take care of this?

@peterdbarkerUK
Copy link
Contributor

@situchan could you complete the checklist?

@peterdbarkerUK
Copy link
Contributor

(Just a note for myself that ohter contribs have been paid, and contract closed)

@situchan
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Default to empty merchant for receipt requests #25924
  • 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/25924/files#r1377800775
  • 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.
  • 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.

Regression Test Proposal

  1. Go to FAB > Request money > select Manual
  2. Input any amount and click Next
  3. Click on the three dots menu and select "Add receipt" and select a file
  4. Enter a description and save
  5. Tap "Request"
  6. Verify that description is not shown and "Request" is shown in preview

@situchan
Copy link
Contributor

@peterdbarkerUK sorry for late. Can you also help with payment on #27710 please?

@ayazhussain79
Copy link
Contributor

@peterdbarkerUK can you please check you have ended contract on upwork without paying

@peterdbarkerUK
Copy link
Contributor

peterdbarkerUK commented Nov 2, 2023

Ah shoot, my mistake @ayazhussain79 - I'd had to add you to the job and didn't correctly pay it out when closing. I'm sorry.

I've sent you a new contract offer, bump me here once you've accepted it!

@ayazhussain79
Copy link
Contributor

@peterdbarkerUK Np, Offer accepted and thank you

@peterdbarkerUK
Copy link
Contributor

Paid, thanks Ayaz!

@peterdbarkerUK
Copy link
Contributor

@situchan I've updated the original issue, thanks for raising it and I'm sorry for the error.

@situchan
Copy link
Contributor

situchan commented Nov 2, 2023

@situchan I've updated the original issue, thanks for raising it and I'm sorry for the error.

No problem. Thanks

Also payment for this one (#28380) is pending

@peterdbarkerUK
Copy link
Contributor

Haha one at a time! I'm working through these but being interrupted by an ongoing interview ;-)

@peterdbarkerUK
Copy link
Contributor

Paid! Leaving open so I can sort out the regression testing tomorrow.

@melvin-bot melvin-bot bot added the Overdue label Nov 6, 2023
@peterdbarkerUK
Copy link
Contributor

QA Update proposal is up, thanks everyone for the fine work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants