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

Fix displaying edited amount in IOU preview for scan failed receipt #36407

Merged
merged 15 commits into from
Mar 12, 2024

Conversation

shahinyan11
Copy link

@shahinyan11 shahinyan11 commented Feb 13, 2024

Details

Fixed Issues

$ #34418
PROPOSAL: #34418 (comment)

Tests

  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
  9. Verify that the edited amount is visible in IOU preview
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

Same as in the Tests section.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2024-02-29.at.13.50.11.mov
Android: mWeb Chrome
2024-02-29.13.27.50.mp4
iOS: Native
Screen.Recording.2024-02-29.at.14.04.43.mov
iOS: mWeb Safari
Untitled.mov
MacOS: Chrome / Safari
Screen.Recording.2024-02-29.at.12.45.17.mov
MacOS: Desktop
Screen.Recording.2024-02-29.at.13.01.49.mov

@shahinyan11 shahinyan11 requested a review from a team as a code owner February 13, 2024 12:28
@melvin-bot melvin-bot bot removed the request for review from a team February 13, 2024 12:28
Copy link

melvin-bot bot commented Feb 13, 2024

@Ollyws Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot requested a review from Ollyws February 13, 2024 12:28
@shahinyan11 shahinyan11 changed the title Fix displaying edited amount IOU preview for scan failed receipt Fix displaying edited amount in IOU preview for scan failed receipt Feb 13, 2024
@shahinyan11 shahinyan11 requested a review from Ollyws February 14, 2024 11:29
@shahinyan11 shahinyan11 requested a review from Ollyws February 14, 2024 12:15
@Ollyws
Copy link
Contributor

Ollyws commented Feb 14, 2024

Can we just get a quick confirmation from @Expensify/design wether the layout here looks ok.
We're just enabling showing the amount along with the Receipt missing details error:

Screenshot 2024-02-14 at 12 31 21

@shahinyan11
Copy link
Author

shahinyan11 commented Feb 14, 2024

Can we just get a quick confirmation from @Expensify/design wether the layout here looks ok. We're just enabling showing the amount along with the Receipt missing details error:

@Ollyws Should I do something about this ? Or you will do it

@dannymcclain
Copy link
Contributor

Something about that "Receipt missing details" text doesn't look right to me. @JmillsExpensify @trjExpensify is that how that message is supposed to show?

Other violations get displayed a bit differently (see screenshot) but I'm not sure if this is really the same thing.

CleanShot 2024-02-14 at 08 27 00@2x

@trjExpensify
Copy link
Contributor

Yep, agree with Danny. It would be best to put that in the dot separator placement. If there's a merchant or description added, it would go where you've currently got Receipt missing details.

@Ollyws
Copy link
Contributor

Ollyws commented Feb 14, 2024

It doesn't look like this design has been implemented yet, is that something in the pipeline or should that be implemented in this PR?
This is how violations are currently showing for me on the lastest main:

Screenshot 2024-02-14 at 16 22 47

@trjExpensify
Copy link
Contributor

I think the pattern does exist, just only on paid workspace plans that have violations. CC: @JmillsExpensify

@Ollyws
Copy link
Contributor

Ollyws commented Feb 15, 2024

Adding violations to the report preview is being added in #33969 so we should probably HOLD on that one.

@Ollyws
Copy link
Contributor

Ollyws commented Feb 19, 2024

#33969 has been merged and as @trjExpensify mentioned it only applies to paid workspaces plans that have violations, with the violations beta enabled.
Is this design going to be rolled out throughout the app soon, or should we just proceed with the PR as is?

@trjExpensify
Copy link
Contributor

I'm not sure when we'll take violations off the beta, @cead22 might have a better idea.

@shahinyan11
Copy link
Author

I'm not sure when we'll take violations off the beta, @cead22 might have a better idea.

What about this comment

@cead22
Copy link
Contributor

cead22 commented Feb 19, 2024

We don't have a date for taking violations off beta, but we can add whatever logins you're using to the beta if you need to test, just share them with us

@Ollyws
Copy link
Contributor

Ollyws commented Feb 20, 2024

If violations isn't getting taken off beta in the forseeable future then I'm not sure if this design is something that should be implemented in this PR.
Perhaps we should move forward with some permutation of #36407 (comment) ? As this is very close to the current design.

@cead22
Copy link
Contributor

cead22 commented Feb 20, 2024

If violations isn't getting taken off beta in the forseeable future then I'm not sure if this design is something that should be implemented in this PR.

This is already implemented

@trjExpensify
Copy link
Contributor

Yeah, SmartScan errors aren't conditional on a violations beta either, so isn't it just taking the design pattern that Carlos references exists in the code and applying it to this case of a failed receipt scan that you edit only some of the fields required but still have violations?

So these here would be displayed after the dot separator in the preview component.

@Ollyws
Copy link
Contributor

Ollyws commented Feb 20, 2024

Ok, so it should be as simple as appending the smartscan errors to the header text message.
Could you take a look at that @shahinyan11, thanks.

@shahinyan11
Copy link
Author

So these here would be displayed after the dot separator in the preview component.

The current solution only displays Report missing details for all cases. will we have to change current solution

message += ` • ${translate('iou.missingMerchant')}`;
}

return message;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with an early return here is that if we have both violations and a smartscan error, only the smartscan error will be displayed where it should display Review required.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ollyws We decided that the smart scan error should take priority. Doesn't current implementation match this comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #36407 (comment) I specified that neither should take priority, so if there is a smartscan error and a violation then we should show Review required.
Unless I'm missing something here.

Copy link
Author

@shahinyan11 shahinyan11 Mar 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ollyws, @trjExpensify, @cead22, @shawnborton Can you give me a detailed specification for all possible cases to follow it . My current changes match this comment . But as you can see @Ollyws doesn't agree with this? I need a clear description for all cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #36407 (comment) I specified that neither should take priority, so if there is a smartscan error and a violation then we should show Review required.

I agree with that. It's effectively "multiple violations" in that case.

Copy link
Author

@shahinyan11 shahinyan11 Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ollyws @trjExpensify Sorry, but the information provided is not enough to understand. Can you explain what is the difference of #36407 (comment) and #36407 (comment) comments . Does not it show Review required if there are both smart scan and violations errors ?

Copy link
Contributor

@Ollyws Ollyws Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shahinyan11 What #36407 (comment) is saying is if there is one item (violation/smartscan error) then we display that item: Cash • Missing amount for example.
If there is more than one item we display Cash • Review required.

Copy link
Author

@shahinyan11 shahinyan11 Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ollyws It turns out the Review required should be displayed there If only merchant or only amount is missing and there is a violation errors . Is it correct ?

@shahinyan11 shahinyan11 requested a review from Ollyws March 3, 2024 16:13
@shahinyan11 shahinyan11 requested a review from trjExpensify March 4, 2024 18:05
@shahinyan11 shahinyan11 requested a review from Ollyws March 5, 2024 18:57
@shahinyan11 shahinyan11 requested a review from Ollyws March 6, 2024 12:23
@shahinyan11 shahinyan11 requested a review from Ollyws March 6, 2024 12:49
@Ollyws
Copy link
Contributor

Ollyws commented Mar 7, 2024

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
01_Android_Native.mp4
Android: mWeb Chrome
02_Android_Chrome.mp4
iOS: Native
03_iOS_Native.mp4
iOS: mWeb Safari
04_iOS_Safari.mp4
MacOS: Chrome / Safari
05_MacOS_Chrome.mp4
MacOS: Desktop
06_MacOS_Desktop.mp4

Copy link
Contributor

@Ollyws Ollyws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@melvin-bot melvin-bot bot requested a review from techievivek March 7, 2024 15:22
@Ollyws
Copy link
Contributor

Ollyws commented Mar 7, 2024

One thing I'll mention but I think is out of scope here, is that on dev and staging the Unknown Merchant label will appear at the bottom briefly after a receipt is finished scanning and dissapear after a moment or page refresh. I think this is a backend issue.

Screen.Recording.2024-03-07.at.15.26.33.mov

@techievivek
Copy link
Contributor

I think that's fine and is certainly a backend issue.

@techievivek techievivek merged commit 59c98ce into Expensify:main Mar 12, 2024
16 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/techievivek in version: 1.4.51-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.51-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants