Skip to content

[$500] Scan - Green dot is displayed for workspace chat that has failed Scan preview with red dot #31031

Closed

Description

@lanitochka17

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


Version Number: 1.3.96-5
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:

Issue found when executing PR #30231

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Go to workspace chat
  3. Go to + > Request money > Scan
  4. Create a scan request
  5. Fail the smartscanning by manually entering the amount
  6. Return to the workspace chat

Expected Result:

A red dot will be displayed for the workspace chat due to the failed scanning

Actual Result:

A green dot is displayed for the workspace chat with failed scanning, while the workspace chat shows Scan preview with a red dot

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

Bug6267939_1699388695694.20231108_041924.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013fd93f0c943296dc
  • Upwork Job ID: 1721992037831143424
  • Last Price Increase: 2023-11-07

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 7, 2023
  2. changed the title [-]Scan - Green dot is displayed for workspace chat that has failed Scan preview with red dot[/-] [+][$500] Scan - Green dot is displayed for workspace chat that has failed Scan preview with red dot[/+] on Nov 7, 2023
  3. melvin-bot commented on Nov 7, 2023

    @melvin-bot
  4. melvin-bot commented on Nov 7, 2023

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 7, 2023
  6. melvin-bot commented on Nov 7, 2023

    @melvin-bot

    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
  7. melvin-bot commented on Nov 7, 2023

    @melvin-bot

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

  8. abdel-h66 commented on Nov 7, 2023

    @abdel-h66
    Contributor

    Proposal

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

    Green dot is displayed for workspace chat that has a preview error.

    What is the root cause of that problem?

    An error in the scan preview will not be considered as an error for the Chat Reports (1:1 or Workspace chats) as we only check for report.errors and report.errorFields in the getAllReportErrors function that sets the brickRoadIndicator value for the LHN items.

    getAllReportErrors also perform some other checks when to check if the report isTransactionThread ,isIOUReport or isExpenseReport and none of these will work for the chat reports.

    Now, since the chat report is considered error free, this line here

    const shouldShowGreenDotIndicator = !hasBrickError && ReportUtils.requiresAttentionFromCurrentUser(optionItem, optionItem.parentReportAction);
    will call requiresAttentionFromCurrentUser

    Which will return true due to the report having an outstanding action in the case of pending payment. hasOutstandingChildRequest

    if (option.hasOutstandingChildRequest) {

    Notice that now if we pay the request, the green dot will disappear as the hasOutstandingChildRequest is no longer present.

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

    If we want to show the red dot in case of a scan error. We need to perform the same logic used in the ReportPreview.js

    For each report action, we need to find the iouReportID from the preview. Using
    ReportActionUtils.getIOUReportIDFromReportActionPreview and then check if that iouReport has a missing scan field using const hasMissingField = ReportUtils.hasMissingSmartscanFields(iouReportID)

    What alternative solutions did you explore? (Optional)

    N/A

  9. DylanDylann commented on Nov 8, 2023

    @DylanDylann
    Contributor

    Proposal

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

    Scan - Green dot is displayed for workspace chat that has failed Scan preview with red dot

    What is the root cause of that problem?

    Let's see the logic to get error of LHNOptionRow we only get error of that report, that report actions and parent report action, we don't get error of child report

    function getAllReportErrors(report, reportActions) {

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

    We need to add logic to get error of child report like this

    const reportActionErrors = _.reduce(
            reportActions,
            (prevReportActionErrors, action) => {
    
                if (action && !_.isEmpty(action.errors)) {
                    _.extend(prevReportActionErrors, action.errors)
                }
                if (ReportUtils.hasMissingSmartscanFields(action.childReportID)) { // We can add a condition to only run this logic if child report type is `expense`
                    _.extend(prevReportActionErrors, {smartscan: ErrorUtils.getMicroSecondOnyxError('report.genericSmartscanFailureMessage')});
                }
               
                return prevReportActionErrors
            },
            {},
        );
    

    It will check all transactions of child report and see that if there is any error.

    One more thing, I want to suggest that we shouldn't display green dot if that request is scanning and there are no other request (only display green dot if the scan is successfull). To do that, in here

    hasOutstandingIOU: iouReport.total !== 0,

    we also need to set

    hasOutstandingChildRequest: iouReport.total !== 0,
    

    and also reset value in FailureData. (also need to fix it in BE)

  10. akinwale commented on Nov 10, 2023

    @akinwale
    Contributor

    After reviewing the proposals, I recommend moving forward with @abdel-h66's proposal as the solution is simple and straightforward. @abdel-h66 The optionItem in OptionRowLHN already has an iouReportID field, so there's no need to call ReportActionUtils.getIOUReportIDFromReportActionPreview to obtain the value.

    @DylanDylann's proposed solution adds unnecessary complexity, and I imagine having to run a _.reduce on every option item in the LHN would cause some performance issues especially with accounts that have a large number of reports open.

    🎀 👀 🎀 C+ reviewed.

  11. melvin-bot commented on Nov 10, 2023

    @melvin-bot

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

  12. DylanDylann commented on Nov 10, 2023

    @DylanDylann
    Contributor

    @akinwale In my proposal, I mean that
    in here

    const reportActionErrors = _.reduce(
    reportActions,
    (prevReportActionErrors, action) => (!action || _.isEmpty(action.errors) ? prevReportActionErrors : _.extend(prevReportActionErrors, action.errors)),
    {},
    );

    we should update like that

    const reportActionErrors = _.reduce(
            reportActions,
            (prevReportActionErrors, action) => {
    
                if (action && !_.isEmpty(action.errors)) {
                    _.extend(prevReportActionErrors, action.errors)
                }
    +     if (ReportUtils.hasMissingSmartscanFields(action.childReportID)) { // We can add a condition to only run this logic if + child report type is `expense`
    +               _.extend(prevReportActionErrors, {smartscan: ErrorUtils.getMicroSecondOnyxError('report.genericSmartscanFailureMessage')});
    +            }
               
                return prevReportActionErrors
            },
            {},
        );
    

    Sorry for my confusion

  13. DylanDylann commented on Nov 10, 2023

    @DylanDylann
    Contributor

    One more thing, I want to suggest that we shouldn't display green dot if that request is scanning and there are no other request (only display green dot if the scan is successfull)

    @akinwale What do you think about this point?
    cc @puneetlath

  14. puneetlath commented on Nov 10, 2023

    @puneetlath
    Contributor

    Raised for discussion in an internal slack channel here: https://expensify.slack.com/archives/C036QM0SLJK/p1699651533409919

    My opinion is that this actually isn't a bug, but we'll discuss and get back to you!

  15. DylanDylann commented on Nov 11, 2023

    @DylanDylann
    Contributor

    @puneetlath I can't access to Slack link, could you help to confirm this point in Slack. Thanks

  16. abdel-h66 commented on Nov 11, 2023

    @abdel-h66
    Contributor

    I don't think we should show the red dot error for all type of actions. The smartscan error should only appear for Preview actions. Otherwise, it would be confusing if the user does not know where the error is coming from when opening the report with a red dot error.

  17. twisterdotcom commented on Nov 13, 2023

    @twisterdotcom
    Contributor

    @puneetlath I think you landed on this being fine right? From the internal discussion:

    In this case the submitter and manager is the same person
    So I think it’s fine since they are getting both according to their dual role

  18. puneetlath commented on Nov 13, 2023

    @puneetlath
    Contributor

    That's what I think yes. Thought it'd be good to have someone else in that thread agree with me 😄

  19. twisterdotcom commented on Nov 13, 2023

    @twisterdotcom
    Contributor

    Ahah, I agree. Seems @JmillsExpensify does too. Let's close then?

  20. puneetlath commented on Nov 13, 2023

    @puneetlath
    Contributor

    Sounds good. Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions