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

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

Closed
6 tasks done
lanitochka17 opened this issue Nov 7, 2023 · 17 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 7, 2023

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: 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
@lanitochka17 lanitochka17 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 Nov 7, 2023
@melvin-bot melvin-bot bot 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 Nov 7, 2023
Copy link

melvin-bot bot commented Nov 7, 2023

Job added to Upwork: https://www.upwork.com/jobs/~013fd93f0c943296dc

Copy link

melvin-bot bot commented Nov 7, 2023

Triggered auto assignment to @twisterdotcom (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 Nov 7, 2023
Copy link

melvin-bot bot commented Nov 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

Copy link

melvin-bot bot commented Nov 7, 2023

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

@abdel-h66
Copy link
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

@DylanDylann
Copy link
Contributor

DylanDylann commented Nov 8, 2023

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)

@akinwale
Copy link
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.

Copy link

melvin-bot bot commented Nov 10, 2023

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

@DylanDylann
Copy link
Contributor

DylanDylann commented Nov 10, 2023

@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

@DylanDylann
Copy link
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

@puneetlath
Copy link
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!

@DylanDylann
Copy link
Contributor

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

@abdel-h66
Copy link
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.

@melvin-bot melvin-bot bot added the Overdue label Nov 13, 2023
@twisterdotcom
Copy link
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

@melvin-bot melvin-bot bot removed the Overdue label Nov 13, 2023
@puneetlath
Copy link
Contributor

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

@twisterdotcom
Copy link
Contributor

twisterdotcom commented Nov 13, 2023

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

@puneetlath
Copy link
Contributor

Sounds good. Closing!

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

6 participants