Skip to content

[Due for payment 2025-02-18] [$250] Per Diem- Per Diem Disappears from Expense Options After Changing Currency Offline #56071

Closed

Description

@IuliiaHerets

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: v9.0.92-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
Email or phone of affected tester (no customers): applausetester+tw4466444@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 13.6/chrome
App Component: Workspace Settings

Action Performed:

1, Go to Settings > Create Workspace.
2, Navigate to Workspace Settings > More Features > Enable Per Diem.
3,Go to Workspace Chat > Click + > Create Expense → Per Diem is available in the options.
4, Switch to Offline Mode, then go to Workspace Settings and change the currency.
5,Return to Workspace Chat > Click + > Create Expense → Per Diem is missing from the options.

Expected Result:

Per Diem should remain available in the expense details even after changing the currency offline.

Actual Result:

Per Diem disappears from the expense details when the currency is changed offline.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6728511_1738239214918.Screen_Recording_2025-01-30_at_4.11.16_AM.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021886146687264382691
  • Upwork Job ID: 1886146687264382691
  • Last Price Increase: 2025-02-02
  • Automatic offers:
    • nkdengineer | Contributor | 105976043
Issue OwnerCurrent Issue Owner: @MitchExpensify

Activity

  1. added
    Bug
    Daily
    on Jan 30, 2025
  2. melvin-bot commented on Jan 30, 2025

    @melvin-bot

    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.

  3. linhvovan29546 commented on Jan 31, 2025

    @linhvovan29546
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-01-31 01:53:32 UTC.

    Proposal

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

    Per Diem- Per Diem Disappears from Expense Options After Changing Currency Offline

    What is the root cause of that problem?

    We display the Per Diem option based on the following condition:

    const shouldShowPerDiemOption =
    iouType !== CONST.IOU.TYPE.SPLIT &&
    iouType !== CONST.IOU.TYPE.TRACK &&
    canUsePerDiem &&
    ((!isFromGlobalCreate && doesCurrentPolicyPerDiemExist) || (isFromGlobalCreate && doesPerDiemPolicyExist));

    When changing the currency while offline, doesCurrentPolicyPerDiemExist becomes false, causing the Per Diem option to disappear.
    Why does this happen? When change the currency, we call the updateGeneralSettings action.
    In this action, customUnits gets overridden when distanceUnit exists, leading to the policy losing the custom unit for Per Diem.

    ...(customUnitID && {
    customUnits: {
    [customUnitID]: {
    ...distanceUnit,
    rates: optimisticRates,
    },

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

    We should include the custom unit's current of the policy in optimisticData, finallyData, and failureData.

    ...(customUnitID && {
    customUnits: {
    [customUnitID]: {
    ...distanceUnit,
    rates: finallyRates,
    },

                    ...(customUnitID && {
                        customUnits: {
                            ...policy?.customUnits, //New code
                            [customUnitID]: {
                                ...distanceUnit,
                                rates: optimisticRates,
                            },
                        },
                    }),

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We can write a test to assert that Per Diem is enabled when changing the currency.

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. moved this to Upcoming Cohorts in [#whatsnext] #migrateon Feb 2, 2025
  5. added
    External
    on Feb 2, 2025
  6. melvin-bot commented on Feb 2, 2025

    @melvin-bot
  7. changed the title [-]Per Diem- Per Diem Disappears from Expense Options After Changing Currency Offline[/-] [+][$250] Per Diem- Per Diem Disappears from Expense Options After Changing Currency Offline[/+] on Feb 2, 2025
  8. added
    Help Wanted
    on Feb 2, 2025
  9. melvin-bot commented on Feb 2, 2025

    @melvin-bot

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

  10. 19 remaining items

  11. melvin-bot commented on Feb 13, 2025

    @melvin-bot

    @arosiclair @MitchExpensify @dukenv0307 @nkdengineer 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!

  12. dukenv0307 commented on Feb 13, 2025

    @dukenv0307
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: https://github.com/Expensify/App/pull/39484/files#r1954731165

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again. Yes

    Regression Test Proposal Template

    Regression Test Proposal

    Test:

    • Precondition: The account only has one group workspace with the per diem feature enabled
    1. Go offline
    2. Go to the workspace overview
    3. Change the currency
    4. Go FAB > Create expense
    5. Verify that the per diem option still appears

    Do we agree 👍 or 👎

  13. added
    Daily
    and removed
    Weekly
    on Feb 17, 2025
  14. MitchExpensify commented on Feb 17, 2025

    @MitchExpensify
    Contributor

    Added QA test

  15. MitchExpensify commented on Feb 17, 2025

    @MitchExpensify
    Contributor

    Payment summary:

  16. JmillsExpensify commented on Feb 20, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @dukenv0307

  17. melvin-bot commented on Feb 21, 2025

    @melvin-bot

    @arosiclair, @MitchExpensify, @dukenv0307, @nkdengineer Whoops! This issue is 2 days overdue. Let's get this updated quick!

  18. MitchExpensify commented on Feb 23, 2025

    @MitchExpensify
    Contributor
  19. moved this from Upcoming Cohorts to Done in [#whatsnext] #migrateon Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions