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

[Payment due][$500] Distance - Distance rate shows undefined when both workspace and request are created offline #30801

Closed
6 tasks done
kbecciv opened this issue Nov 2, 2023 · 26 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Nov 2, 2023

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.95.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:

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Go offline.
  3. Create a workspace (do not change workspace settings like name).
  4. Go to the workspace chat.
  5. Go to + > Request money > Distance.
  6. Proceed to confirmation page.

Expected Result:

The currency for distance rate in Distance row shows the default currency of the workspace.

Actual Result:

The currency for distance rate in Distance row shows undefined.
If the workspace is created in offline mode and the name is changed, it shows the default currency instead of undefined.

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

Bug6261445_1698959061168.20231103_033407-2.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0175de9ce3ccbd5187
  • Upwork Job ID: 1720189005781348352
  • Last Price Increase: 2023-11-09
  • Automatic offers:
    • dukenv0307 | Contributor | 27606634
Issue OwnerCurrent Issue Owner: @eVoloshchak
@kbecciv kbecciv 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 2, 2023
@melvin-bot melvin-bot bot changed the title Distance - Distance rate shows undefined when both workspace and request are created offline [$500] Distance - Distance rate shows undefined when both workspace and request are created offline Nov 2, 2023
Copy link

melvin-bot bot commented Nov 2, 2023

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

Copy link

melvin-bot bot commented Nov 2, 2023

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

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

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

@brandond98
Copy link

brandond98 commented Nov 2, 2023

Proposal

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

Distance rate showing us undefined when creating a workspace and distance expense offline

What is the root cause of that problem?

When offline the currency parameter passed to the getDistanceMerchant function is undefined

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

Add a check to the currencySymbol variable checking if currency is falsey, if it is then provide a default value:

const getDistanceMerchant = (hasRoute, distanceInMeters, unit, rate, currency, translate, toLocaleDigit) => {
    const distanceInUnits = hasRoute ? getRoundedDistanceInUnits(distanceInMeters, unit) : translate('common.tbd');

    const distanceUnit = unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.miles') : translate('common.kilometers');
    const singularDistanceUnit = unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.mile') : translate('common.kilometer');
    const unitString = distanceInUnits === 1 ? singularDistanceUnit : distanceUnit;
    const ratePerUnit = rate ? PolicyUtils.getUnitRateValue({rate}, toLocaleDigit) : translate('common.tbd');
    const currencySymbol = currency ? CurrencyUtils.getCurrencySymbol(currency) || `${currency} ` : CurrencyUtils.getCurrencySymbol('USD');

    return `${distanceInUnits} ${unitString} @ ${currencySymbol}${ratePerUnit} / ${singularDistanceUnit}`;
};

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.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Nov 3, 2023

Proposal

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

The currency for distance rate in Distance row shows undefined.
If the workspace is created in offline mode and the name is changed, it shows the default currency instead of undefined.

What is the root cause of that problem?

When we initially created the workspace, we do not set the optimistic currency for the Default Rate, that's why when we try to get and show the currency here, it shows undefined. But when we update workspace General Settings here, it will update the Default Rate currency to workspace currency (outputCurrency), that's why it shows correctly after updating the general settings.

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

Set optimistic currency for the Default Rate same as the workspace currency. We can add a currency param to here, and in the places we use it to build optimistic custom units, we pass in the same default currency as we do for the workspace's outputCurrency here.

What alternative solutions did you explore? (Optional)

Use outputCurrency as the fallback currency in MoneyRequestConfirmationList if the currency here is undefined

@melvin-bot melvin-bot bot added the Overdue label Nov 6, 2023
Copy link

melvin-bot bot commented Nov 6, 2023

@eVoloshchak, @kadiealexander Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@kadiealexander
Copy link
Contributor

@eVoloshchak bump!

@melvin-bot melvin-bot bot removed the Overdue label Nov 7, 2023
@eVoloshchak
Copy link
Contributor

I think we should proceed with @dukenv0307's proposal

While @brandond98's proposal would resolve this particular issue, it's fixing a symptom, not the root cause
Adding a default currency in optimistic data when creating a workspace is a better, more general approach

🎀👀🎀 C+ reviewed!

Copy link

melvin-bot bot commented Nov 7, 2023

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

Copy link

melvin-bot bot commented Nov 9, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@robertjchen
Copy link
Contributor

Agreed, @dukenv0307 's approach is better in setting the optimistic data when creating a workspace 👍

@melvin-bot melvin-bot bot removed the Overdue label Nov 10, 2023
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 10, 2023
Copy link

melvin-bot bot commented Nov 10, 2023

📣 @eVoloshchak Please request via NewDot manual requests for the Reviewer role ($500)

Copy link

melvin-bot bot commented Nov 10, 2023

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 10, 2023
@dukenv0307
Copy link
Contributor

@eVoloshchak The PR is ready for review.

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Dec 4, 2023
Copy link

melvin-bot bot commented Dec 4, 2023

This issue has not been updated in over 15 days. @robertjchen, @eVoloshchak, @kadiealexander, @dukenv0307 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@eVoloshchak
Copy link
Contributor

eVoloshchak commented Dec 8, 2023

PR has been deployed to production on December 6th

@kadiealexander kadiealexander added Daily KSv2 and removed Monthly KSv2 labels Dec 20, 2023
@kadiealexander kadiealexander changed the title [$500] Distance - Distance rate shows undefined when both workspace and request are created offline [Payment due][$500] Distance - Distance rate shows undefined when both workspace and request are created offline Dec 20, 2023
@kadiealexander
Copy link
Contributor

kadiealexander commented Dec 20, 2023

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:

  • [@eVoloshchak] The PR that introduced the bug has been identified. Link to the PR:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] Determine if we should create a regression test for this bug.
  • [@eVoloshchak] 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.
  • [@kadiealexander] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@kadiealexander
Copy link
Contributor

kadiealexander commented Dec 20, 2023

Payouts due:

Eligible for 50% #urgency bonus? No

Upwork job is here.

@kadiealexander
Copy link
Contributor

@eVoloshchak please action the bugzero checklist so we can close this one out :)

@kadiealexander
Copy link
Contributor

Noting that I'm on leave from tomorrow until Jan 8th and will check in on my return. @eVoloshchak please feel free to request payment via manual request once the BugZero checklist is done from your side.

@kadiealexander kadiealexander added Weekly KSv2 and removed Daily KSv2 labels Dec 22, 2023
@eVoloshchak
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: there isn't a PR that introduced this issue, it's an edge case missed during the initial implementation
  • 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: N/A
  • 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: I don't think an additional discussion is needed here
  • Determine if we should create a regression test for this bug.
    Is it easy to test for this bug? Yes
    Is the bug related to an important user flow? Yes
    Is it an impactful bug? No

@eVoloshchak
Copy link
Contributor

Regression Test Proposal

  1. Go offline
  2. Create a new workspace
  3. Go to policy expense chat of the workspace
  4. Create a distance request
  5. Select the start and finish address
  6. Click Next
  7. Verify that the default currency is displayed in the Distance row instead of undefined

Do we agree 👍 or 👎

@JmillsExpensify
Copy link

$500 payment approved for @eVoloshchak based on this comment.

@robertjchen
Copy link
Contributor

Any remaining steps here before we can close this out?

@robertjchen
Copy link
Contributor

Closing this out for now, please re-open if we need to do anything else here.

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. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants