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-03-20] [$500] IOU – Edited amount in a receipt scan failed is not visible in IOU preview. #34418

Closed
3 of 6 tasks
kavimuru opened this issue Jan 12, 2024 · 69 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Jan 12, 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: v1.4.24-7
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
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

Action Performed:

  1. Open New Expensify app.
  2. Log in as the WS employee
  3. Create fail scan request
  4. After the scanned receipt shows a failure
  5. Navigate to the workspace chat
  6. Click on the preview to navigate to the report conversation
  7. Edit the missing field Amount only
  8. Navigate back to the IOU preview

Expected Result:

Edited amount in a receipt scan failed is visible in IOU preview

Actual Result:

Edited amount in a receipt scan failed is not visible in IOU preview. When edit merchant only in a receipt scan failed – merchant name is visible in IOU preview.

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

Bug6339893_1705049915252.Edited_amount_in_a_receipt_scan_failed_is_not_visible_in_IOU_preview.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016702df242a6ed127
  • Upwork Job ID: 1745744530634809344
  • Last Price Increase: 2024-02-02
  • Automatic offers:
    • Ollyws | Reviewer | 0
    • shahinyan11 | Contributor | 0
@kavimuru kavimuru 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 Jan 12, 2024
Copy link

melvin-bot bot commented Jan 12, 2024

Job added to Upwork: https://www.upwork.com/jobs/~016702df242a6ed127

@melvin-bot melvin-bot bot changed the title IOU – Edited amount in a receipt scan failed is not visible in IOU preview. [$500] IOU – Edited amount in a receipt scan failed is not visible in IOU preview. Jan 12, 2024
Copy link

melvin-bot bot commented Jan 12, 2024

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

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

melvin-bot bot commented Jan 12, 2024

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

@DylanDylann
Copy link
Contributor

DylanDylann commented Jan 12, 2024

Proposal

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

What is the root cause of that problem?

Currently, we are handle amount, receiptScanning, receiptMissingDetail in this function

const getDisplayAmountText = () => {
if (isDistanceRequest) {
return requestAmount && !hasPendingWaypoints ? CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency) : translate('common.tbd');
}
if (isScanning) {
return translate('iou.receiptScanning');
}
if (!isSettled && TransactionUtils.hasMissingSmartscanFields(props.transaction)) {
return Localize.translateLocal('iou.receiptMissingDetails');
}
return CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency);
};

So, at a time we only display one of them

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

As new expected, we allow to display amount along with error message. To do that

Firstlt, we should move this code

if (isScanning) {
return translate('iou.receiptScanning');
}
if (!isSettled && TransactionUtils.hasMissingSmartscanFields(props.transaction)) {
return Localize.translateLocal('iou.receiptMissingDetails');
}

to new function like this

    const shouldShowMessage = !isDistanceRequest && (isScanning || (!isSettled && TransactionUtils.hasMissingSmartscanFields(props.transaction)))

const getDisplayMessageText = () => {
        if (isScanning) {
            return translate('iou.receiptScanning');
        }

        if (!isSettled && TransactionUtils.hasMissingSmartscanFields(props.transaction)) {
            return Localize.translateLocal('iou.receiptMissingDetails');
        }
    };

The new variable shouldShowMessage as a flag to check if we should display getDisplayMessageText()

And then here

we should add a condition to display the amount (only display the amount, if it is valuable)

                           {requestAmount>0 && <Text
                                        style={[
                                            styles.textHeadline,
                                            props.isBillSplit &&
                                                StyleUtils.getAmountFontSizeAndLineHeight(isSmallScreenWidth, windowWidth, displayAmount.length, sortedParticipantAvatars.length),
                                            isDeleted && styles.lineThrough,
                                        ]}
                                        numberOfLines={1}
                                    >
                                        {displayAmount}
                                    </Text>}

Then in here


Add new element to display message like this

                                    {shouldShowMessage && <Text
                                        style={[
                                            styles.textHeadline,
                                            props.isBillSplit &&
                                                StyleUtils.getAmountFontSizeAndLineHeight(isSmallScreenWidth, windowWidth, displayAmount.length, sortedParticipantAvatars.length),
                                            isDeleted && styles.lineThrough,
                                        ]}
                                        numberOfLines={1}
                                    >
                                        {getDisplayMessageText()}
                                    </Text>}

Because we added a new element, we need to update the style here

<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>

to

<View style={[styles.flex1, styles.flexColumn]}>
Screenshot 2024-02-01 at 22 33 39

@shahinyan11
Copy link

shahinyan11 commented Jan 12, 2024

Proposal

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

IOU – Edited amount in a receipt scan failed is not visible in IOU preview.

What is the root cause of that problem?

getDisplayAmountText function returns the text "Receipt missing details" if there missing required fields . And the return value is used to display the amount

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

We can replace this condition with below code. But with this solution the "Missing Receipt Details" text will be visible only when the amount is missing and if the merchant is missing the text will not be visible

if (isAmountMissing(props.transaction)) {
      return Localize.translateLocal('iou.receiptMissingDetails');
}

But I think that the text "Missing Receipt Details" should be visible if any of the required parameters is missing.
And because of that I provide alternative solution

What alternative solutions did you explore? (Optional)

  1. Add below lines in MoneyRequestPreview component
const isMissingDetails = TransactionUtils.hasMissingSmartscanFields(props.transaction);
const shouldShowAmount = isScanning || !isAmountMissing(props.transaction)
  1. Remove this condition from getDisplayAmountText
  2. Add below condition for displaying this Text
{shouldShowAmount && (
    <Text
        style={[
           styles.textHeadline,
           props.isBillSplit &&
           StyleUtils.getAmountFontSizeAndLineHeight(isSmallScreenWidth, windowWidth, displayAmount.length, sortedParticipantAvatars.length),
           isDeleted && styles.lineThrough,
       ]}
       numberOfLines={1}
    >
      {displayAmount}
    </Text>
)}
  1. Add below code under this line
 {isMissingDetails && (
      <View style={[styles.flexRow]}>
          <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
              <Text
                  style={styles.textHeadline}
                  numberOfLines={1}
              >
                  {Localize.translateLocal('iou.receiptMissingDetails')}
              </Text>
          </View>
      </View>
)}
Screen.Recording.2024-01-12.at.17.11.49.mov

@shahinyan11
Copy link

Proposal

Updated

@melvin-bot melvin-bot bot added the Overdue label Jan 14, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Jan 15, 2024

Will review asap.

@melvin-bot melvin-bot bot removed the Overdue label Jan 15, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Jan 16, 2024

Thanks for the proposals, but does anyone have any insight as to why this is only happening in workspace chats, it seems to work fine in a 1-1 chat.

@DylanDylann

This comment was marked as duplicate.

@DylanDylann
Copy link
Contributor

@Ollyws Updated proposal I think the actual result in OP is correct, the error should be shown because the merchant field is required and It is empty.
In the 1:1 chat after editing the amount the error is replaced by a new amount. I think this is a bug
cc @dylanexpensify

@dylanexpensify
Copy link
Contributor

Thanks @DylanDylann! cc @Ollyws to review update

@shahinyan11
Copy link

shahinyan11 commented Jan 17, 2024

Thanks for the proposals, but does anyone have any insight as to why this is only happening in workspace chats, it seems to work fine in a 1-1 chat.

Because the report type is different in workspace and 1:1 chats. This condition is true for workspace chats and false for 1:1 chats . @Ollyws Are you sure that it works fine for 1:1 chat ?

I think before updating our proposal we need clarify what is the correct behavior . Is there any documentation which describes how should display the preview for each case ? Or we need more detailed expected result . Should the text "Missing Receipt Details" be displayed when the amount exists but the merchant is empty ?

@Ollyws
Copy link
Contributor

Ollyws commented Jan 18, 2024

Thank you both for looking into it.
I'm unsure wether this is a bug atall, it seems that for 1-1 money requests the merchant is not required, whereas for requests in a workspace chat the merchant field is required. This means it makes sense for the reciept scan to show Receipt missing details in a workspace chat if the merchant field is left empty.

@shahinyan11
Copy link

shahinyan11 commented Jan 18, 2024

@Ollyws I think is still needs be fixed because current behavior is following. If the merchant exists and the amount does not, the preview displays both the error message and the merchant. But if the amount exists and the merchant does not, only an error message is displayed.
Screenshot 2024-01-18 at 16 58 00

@DylanDylann
Copy link
Contributor

@Ollyws

it seems that for 1-1 money requests the merchant is not required,

I think we should ping an internal engineer to confirm it

Copy link

melvin-bot bot commented Jan 19, 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 added the Overdue label Jan 22, 2024
@dylanexpensify
Copy link
Contributor

@Ollyws shall we get internal on this?

@melvin-bot melvin-bot bot removed the Overdue label Jan 23, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Jan 23, 2024

Yes but just to confirm the desired behaviour, I'm not sure it necessarily has to be an internal issue.

Copy link

melvin-bot bot commented Jan 26, 2024

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

@dylanexpensify
Copy link
Contributor

PR merged! Pending regression period then payments

Copy link

melvin-bot bot commented Mar 13, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 13, 2024
@melvin-bot melvin-bot bot changed the title [$500] IOU – Edited amount in a receipt scan failed is not visible in IOU preview. [HOLD for payment 2024-03-20] [$500] IOU – Edited amount in a receipt scan failed is not visible in IOU preview. Mar 13, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 13, 2024
Copy link

melvin-bot bot commented Mar 13, 2024

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

Copy link

melvin-bot bot commented Mar 13, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.51-3 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 2024-03-20. 🎊

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

Copy link

melvin-bot bot commented Mar 13, 2024

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:

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

@dylanexpensify
Copy link
Contributor

Payment coming up!

@Ollyws
Copy link
Contributor

Ollyws commented Mar 20, 2024

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR:

I wouldn't call this a bug, it was originally just part of the design to replace the amount with Receipt missing details, so more of a new feature/design.

  • 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:

N/A

  • 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.

Yes as it's a new feature.

  • 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. Log in as the WS employee
2. Create failed scan request
3. Navigate to the workspace chat
4. Click on the preview to navigate to the report conversation
5. Edit the missing amount field only
6. Navigate back to the IOU preview
7. Verify that the edited amount is visible in the IOU preview

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 20, 2024
@shahinyan11
Copy link

@dylanexpensify Could you send the payment please ?

@melvin-bot melvin-bot bot added the Overdue label Mar 25, 2024
@dylanexpensify
Copy link
Contributor

Payment summary:

@melvin-bot melvin-bot bot removed the Overdue label Mar 25, 2024
@dylanexpensify
Copy link
Contributor

@Ollyws can you accept offer? @shahinyan11 you've been paid!

@Ollyws
Copy link
Contributor

Ollyws commented Mar 25, 2024

@DylanDylann I don't see any offer, I think it may have expired. Apologies!

@Ollyws
Copy link
Contributor

Ollyws commented Mar 25, 2024

I meant to direct #34418 (comment) at @dylanexpensify, that's the second time I've done that now 😆

@dylanexpensify
Copy link
Contributor

Ahh, let me get you a new one @Ollyws!

@dylanexpensify
Copy link
Contributor

@Ollyws
Copy link
Contributor

Ollyws commented Mar 26, 2024

@dylanexpensify Thanks but that seems to just be a job rather than an offer.

@dylanexpensify
Copy link
Contributor

Yeah, if you can just apply to it 😄

@Ollyws
Copy link
Contributor

Ollyws commented Mar 26, 2024

Done!

@dylanexpensify
Copy link
Contributor

dylanexpensify commented Mar 26, 2024 via email

@Ollyws
Copy link
Contributor

Ollyws commented Mar 26, 2024

Accepted, thanks!

@dylanexpensify
Copy link
Contributor

Done!

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants