App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Expense - Amount in expense preview does not match the edited amount in deleted workspace

Open izarutskaya opened this issue 1 year ago β€’ 18 comments

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: 9.0.65-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5250638 Email or phone of affected tester (no customers): [email protected] Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a new workspace.
  3. Go to workspace chat.
  4. Submit an expense.
  5. Delete the workspace.
  6. Go back to the workspace chat.
  7. Click on the expense preview.
  8. Click Amount.
  9. Edit the amount and save it.
  10. Go back to the main workspace chat.

Expected Result:

The amount in the expense preview in the main chat will match the edited amount.

Actual Result:

The amount in the expense preview in the main chat does not match the edited amount. This issue only happens when the workspace is deleted.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • [x] Android: Standalone
  • [x] Android: HybridApp
  • [x] Android: mWeb Chrome
  • [x] iOS: Standalone
  • [x] iOS: HybridApp
  • [x] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/34996898-d9a6-4bff-839e-17bc988d767f

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021860113886210272641
  • Upwork Job ID: 1860113886210272641
  • Last Price Increase: 2024-12-07
Issue OwnerCurrent Issue Owner: @aldo-expensify

izarutskaya avatar Nov 21 '24 12:11 izarutskaya

Triggered auto assignment to @MitchExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Nov 21 '24 12:11 melvin-bot[bot]

Proposal

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

Amount in expense preview does not match the edited amount in deleted workspace

What is the root cause of that problem?

This is a backend issue. I say that because the total in the response is incorrect, so we display it incorrectly

  • Screenshot 2024-11-21 at 22 01 44

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

I think, in this case, I must disable expenses to prevent updates when the workspace is archived, to avoid calculating the wrong value and incorrect logic. Some thing like this:

// src/components/ReportActionItem/MoneyRequestView.tsx#L438
+    const isArchivedRoom = ReportUtils.isArchivedRoomWithID(parentReport?.chatReportID);

// src/components/ReportActionItem/MoneyRequestView.tsx#L514
      <MenuItemWithTopDescription
          title={amountTitle}
          shouldShowTitleIcon={isSettled}
          titleIcon={Expensicons.Checkmark}
          description={amountDescription}
          titleStyle={styles.textHeadlineH2}
          interactive={canEditAmount}
          shouldShowRightIcon={canEditAmount}
          onPress={() =>
              Navigation.navigate(
                  ROUTES.MONEY_REQUEST_STEP_AMOUNT.getRoute(
                      CONST.IOU.ACTION.EDIT,
                      iouType,
                      transaction?.transactionID ?? '-1',
                      report?.reportID ?? '-1',
                      '',
                      Navigation.getReportRHPActiveRoute(),
                  ),
              )
          }
          brickRoadIndicator={getErrorForField('amount') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
          errorText={getErrorForField('amount')}
+          disabled={isArchivedRoom}
      />

We will do it like this for the description, date, and so on, if needed.

POC
  • Screenshot 2024-11-21 at 22 32 56

What alternative solutions did you explore? (Optional)

huult avatar Nov 21 '24 15:11 huult

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

melvin-bot[bot] avatar Nov 23 '24 00:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 23 '24 00:11 melvin-bot[bot]

Proposal

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

The amount in the expense preview in the main chat does not match the edited amount. This issue only happens when the workspace is deleted.

What is the root cause of that problem?

We're not disabling edit the money request when the workspace is deleted.

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

We should return false if the chat report is archived or the policy doesn't exist

if (!policy || isArchivedRoom(chatReport)) {
    return false;
}

https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/libs/ReportUtils.ts#L3133

What alternative solutions did you explore? (Optional)

NA

nkdengineer avatar Nov 25 '24 10:11 nkdengineer

Expenses should remain editable even if the workspace is deleted https://github.com/Expensify/App/issues/51164#issuecomment-2429193154. This is a BE bug @MitchExpensify.

andriivitiv avatar Nov 25 '24 10:11 andriivitiv

Expenses should remain editable even if the workspace is deleted #51164 (comment).

Thanks @CyberAndrii for the context. This then looks like a BE issue. Let us also bring the internal engineer to weigh in here and conclude on the way ahead. πŸŽ€πŸ‘€πŸŽ€

rojiphil avatar Nov 25 '24 16:11 rojiphil

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

melvin-bot[bot] avatar Nov 25 '24 16:11 melvin-bot[bot]

Asking here to confirm the expected behaviour: https://github.com/Expensify/App/issues/51164#issuecomment-2502535625 . Just in case we made that decision to avoid having to work on something we don't care. Now we will have to work in the backend to fix the inconsistency and I would prefer to shift this work to the frontend if we really don't care about the expected behaviour.

aldo-expensify avatar Nov 27 '24 02:11 aldo-expensify

Ok, seems like the expected behaviour is correct here, so I'll investigate why the backend is not modifying the data then.

aldo-expensify avatar Nov 27 '24 18:11 aldo-expensify

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Nov 30 '24 16:11 melvin-bot[bot]

Can't reproduce in main:

https://github.com/user-attachments/assets/40426195-6876-41b1-b46a-4869c58b6b7c

Going to try staging...

aldo-expensify avatar Dec 03 '24 02:12 aldo-expensify

In staging I see some currency conversion bug: The amount gets converted to the amount in USD, but it still says CA$:

https://github.com/user-attachments/assets/7074028c-3dcd-4bd2-9e36-c1e26832ded5

The transaction comes from the backend with the right modifiedAmount: -2500, but the reportAction preview has a value that looks off:

{
    "childCanHold": true,
    "childCanUnhold": false,
    "childCommenterCount": 0,
    "childLastActorAccountID": 18775088,
    "childLastMoneyRequestComment": "",
    "childLastReceiptTransactionIDs": "",
    "childLastVisibleActionCreated": "",
    "childManagerAccountID": 18775088,
    "childMoneyRequestCount": 1,
    "childOldestFourAccountIDs": "",
    "childOwnerAccountID": 18775088,
    "childRecentReceiptTransactionIDs": [],
    "childReportID": 7008012655928011,
    "childReportName": "Expense Report #7008012655928011",
    "childReportNotificationPreference": "hidden",
    "childStateNum": 1,
    "childStatusNum": 1,
    "childType": "expense",
    "childVisibleActionCount": 0,
    "message": [
        {
            "html": " owes C$32.11",
            "text": " owes C$32.11",
            "type": "COMMENT",
            "whisperedTo": []
        }
    ],
    "originalMessage": {
        "isNewDot": true,
        "lastModified": "2024-12-03 02:17:07.709",
        "linkedReportID": "7008012655928011"
    }
}

aldo-expensify avatar Dec 03 '24 02:12 aldo-expensify

hmm, I'm not able to reproduce the currency issue that I saw in staging: https://github.com/Expensify/App/issues/52896#issuecomment-2513403728 in dev

aldo-expensify avatar Dec 03 '24 02:12 aldo-expensify

@izarutskaya can you check if this issue is still reproducible? πŸ™

aldo-expensify avatar Dec 03 '24 02:12 aldo-expensify

@rojiphil @MitchExpensify @aldo-expensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 05 '24 09:12 melvin-bot[bot]

@rojiphil, @MitchExpensify, @aldo-expensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 06 '24 09:12 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 07 '24 16:12 melvin-bot[bot]

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

MelvinBot avatar Dec 09 '24 22:12 MelvinBot

Adding Needs Reproduction since I'm failing to reproduce

aldo-expensify avatar Dec 09 '24 22:12 aldo-expensify

Unassigning myself as I don’t think there is anything to be done in FE. But will stay subscribed though. Thanks.

rojiphil avatar Dec 13 '24 04:12 rojiphil

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 14 '24 16:12 melvin-bot[bot]

@MitchExpensify, @aldo-expensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 16 '24 09:12 melvin-bot[bot]

@MitchExpensify, @aldo-expensify Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Dec 18 '24 09:12 melvin-bot[bot]

@MitchExpensify @aldo-expensify this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

melvin-bot[bot] avatar Dec 19 '24 09:12 melvin-bot[bot]

None of us can reproduce, @izarutskaya can you?

MitchExpensify avatar Dec 19 '24 16:12 MitchExpensify

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 21 '24 16:12 melvin-bot[bot]

@MitchExpensify, @aldo-expensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 23 '24 09:12 melvin-bot[bot]

Switching to weekly while we wait for reproduction

MitchExpensify avatar Dec 23 '24 16:12 MitchExpensify

@MitchExpensify Tester still can reproduce this issue Build v9.0.79-0

https://github.com/user-attachments/assets/3f868399-1576-4865-8258-224a6a9dad39

izarutskaya avatar Dec 27 '24 10:12 izarutskaya