Skip to content

[HOLD for payment 2024-03-14] [$500] [MEDIUM] Expense Report - In an offline created expense report, a negative request amount is displayed in the Header and Title #36267

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.4.39-0
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 #35913

Action Performed:

Preconditions:
Set up an OldDot administrator account, invite the employee to the policy https://sites.google.com/applausemail.com/applause-expensifyproject/wiki-guides/newdot-categories?authuser=0

  1. Open https://staging.new.expensify.com/
  2. Log in with the account of the employee added to the policy
  3. Navigate to the group policy chat room
  4. Turn off the internet
  5. Create a manual request and send it to the WS room
  6. Go to Report Conversation

Expected Result:

IOU created offline should not display a negative amount in the header and title

Actual Result:

In an offline created IOU, a negative request amount is displayed in the Header and Title

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

Bug6373401_1707479630694.Recording__1319.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013de0165fd934bba3
  • Upwork Job ID: 1755994535213568000
  • Last Price Increase: 2024-02-09
  • Automatic offers:
    • paultsimura | Contributor | 0

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Feb 9, 2024
  2. changed the title [-]IOU - In an offline created IOU, a negative request amount is displayed in the Header and Title[/-] [+][$500] IOU - In an offline created IOU, a negative request amount is displayed in the Header and Title[/+] on Feb 9, 2024
  3. melvin-bot commented on Feb 9, 2024

    @melvin-bot
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 9, 2024
  5. melvin-bot commented on Feb 9, 2024

    @melvin-bot

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

  6. melvin-bot commented on Feb 9, 2024

    @melvin-bot

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

  7. lanitochka17 commented on Feb 9, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #vip-bills

  8. paultsimura commented on Feb 9, 2024

    @paultsimura
    Contributor

    Proposal

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

    Optimistically created Expense report contains a negative value in the title.

    What is the root cause of that problem?

    When setting the optimistic reportName of the newly created Expense report, we use the incorrect value for the formatted total:

    App/src/libs/ReportUtils.ts

    Lines 2820 to 2824 in ad3d78c

    // The amount for Expense reports are stored as negative value in the database
    const storedTotal = total * -1;
    const policyName = getPolicyName(allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`]);
    const formattedTotal = CurrencyUtils.convertToDisplayString(storedTotal, currency);
    const policy = getPolicy(policyID);

    The storedTotal is a negated numeric value that should be stored in the DB: we store the Expense reports' total as a negative value. However, this shouldn't affect the user-visible content – report title.

    Note: this happens only with the enabled report fields beta. With it, we show the report field value in the title. Otherwise, we calculate the title dynamically and negate this amount correctly.

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

    When coming online, the RequestMoney API response changes this report title to the Expense Report #{reportID}:

    image image

    We should change the optimistic expense report creation to set the reportName in a similar way so that the optimistic data is aligned with the future Server response:

    reportName: `Expense Report ${reportID}`,

    reportName: `${policyName} owes ${formattedTotal}`,

    What alternative solutions did you explore? (Optional)

    If we don't want to change the report title format, but keep the "${policy} owes $amount" format for the optimistic expense reports, we should simply use the total instead of storedTotal when building the formattedTotal, which is used only in the report title:

    const formattedTotal = CurrencyUtils.convertToDisplayString(total, currency);
  9. mallenexpensify commented on Feb 9, 2024

    @mallenexpensify
    Contributor

    Checking to see if this fits with #wave6-collect-submitters cuz of "Create a manual request and send it to the WS room"

  10. mananjadhav commented on Feb 12, 2024

    @mananjadhav
    Collaborator

    @mallenexpensify Should this be further reviewed?

  11. 75 remaining items

  12. changed the title [-][$500] [MEDIUM] Expense Report - In an offline created expense report, a negative request amount is displayed in the Header and Title[/-] [+][HOLD for payment 2024-03-14] [$500] [MEDIUM] Expense Report - In an offline created expense report, a negative request amount is displayed in the Header and Title[/+] on Mar 7, 2024
  13. melvin-bot commented on Mar 7, 2024

    @melvin-bot

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

  14. melvin-bot commented on Mar 7, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.48-0 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-14. 🎊

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

  15. melvin-bot commented on Mar 7, 2024

    @melvin-bot

    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:

    • [@mananjadhav / @paultsimura] The PR that introduced the bug has been identified. Link to the PR:
    • [@mananjadhav / @paultsimura] 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:
    • [@mananjadhav / @paultsimura] 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:
    • [@mananjadhav / @paultsimura] Determine if we should create a regression test for this bug.
    • [@mananjadhav / @paultsimura] 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.
    • [@mallenexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  16. mallenexpensify commented on Mar 10, 2024

    @mallenexpensify
    Contributor

    @mananjadhav plz fill out the BZ checklist from above, thx

  17. mananjadhav commented on Mar 15, 2024

    @mananjadhav
    Collaborator

    While we added the storedTotal logic in this commit, I wouldn't count this as an offending PR as I am not sure when the ReportFields was enabled.

    Nevertheless, I think it. makes sense to add a regression test for this one. I think the Test steps from the PR are good. I am not sure how do we mention the preconditions here @mallenexpensify.

    @mallenexpensify Can you please add the payout summary so that I can raise the request?

  18. mallenexpensify commented on Mar 15, 2024

    @mallenexpensify
    Contributor

    Contributor: @paultsimura paid $500 via Upwork
    Contributor+: @mananjadhav due $500 via NewDot.

    Thanks @mananjadhav , I just copy/pasted the preconditions from the PR, along with the steps.

  19. JmillsExpensify commented on Mar 18, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @mananjadhav based on summary above.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions