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

[HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] [iOS] - Workspace - Distance rate separator in Spanish causes errors #27595

Closed
1 of 6 tasks
izarutskaya opened this issue Sep 16, 2023 · 46 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Sep 16, 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!


Action Performed:

  1. Make sure that iOS region is set to Spain (I also set keyboard language to Spanish as well as device language)
  2. Change expensify language to Spanish
  3. Go into workspace settings > reimbursements > track distance
  4. Change rate to anything using comma

Expected Result:

There should be no errors displayed

Actual Result:

There is error displayed and only when you use "." as a separator (not ",") is it working

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.3.70-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

Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-09-13.at.11.29.28.mov
Rpreplay.Final1694889723.mp4

Expensify/Expensify Issue URL:

Issue reported by: @BartoszGrajdek

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694604963679959

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a56c81afd242643d
  • Upwork Job ID: 1703121221956730880
  • Last Price Increase: 2023-09-30
  • Automatic offers:
    • situchan | Reviewer | 27095783
    • akinwale | Contributor | 27095785
@izarutskaya izarutskaya 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 Sep 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 16, 2023

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

@melvin-bot melvin-bot bot changed the title [iOS] - Workspace - Distance rate separator in Spanish causes errors [$500] [iOS] - Workspace - Distance rate separator in Spanish causes errors Sep 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 16, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 16, 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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 16, 2023

Triggered auto assignment to @CortneyOfstad (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Sep 16, 2023

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

@akinwale
Copy link
Contributor

akinwale commented Sep 16, 2023

Proposal

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

The comma used as a decimal separator for the distance rate when the current language is Spanish is causing a form validation error.

What is the root cause of that problem?

Spanish uses a comma as the decimal separator, while English uses a dot. parseFloat in JavaScript does not support commas as a decimal separator.

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

Solution 1
Update the parseFloat call in the validate method of the WorkspaceRateAndUnitPage component.

} else if (parseFloat(values.rate) <= 0) {

-} else if (parseFloat(values.rate) <= 0) {
+} else if (parseFloat(values.rate.replace(new RegExp(`\\${decimalSeparator}`, 'i'), '.')) <= 0) {
  errors.rate = 'workspace.reimburse.lowRateError';
}

Or to make things simpler:

} else if parseFloat(values.rate.replace(',', '.')) <= 0) {

It looks like the simpler approach is already being used in the getNumericValue method in the same file, so we can adopt this here.

We can also conditionally perform the regex replacement if the current language is Spanish.

Solution 2
Use a third-party package which supports locale-based parsing of numeric values.

What alternative solutions did you explore? (Optional)

None.

@CortneyOfstad
Copy link
Contributor

@anmurali There is a known issue with two individuals being assigned to the same issue for BZ (more info here), so going to remove my assignment 👍

@CortneyOfstad CortneyOfstad removed their assignment Sep 18, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

@anmurali, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot
Copy link

melvin-bot bot commented Sep 23, 2023

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

@akinwale
Copy link
Contributor

@situchan Did you get a chance to review my proposal here yet? Thanks.

@anmurali
Copy link

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2023
@situchan
Copy link
Contributor

@akinwale thanks for the proposal. I think there should be pattern to parse locale based numeric values in the app.
parseFloat(values.rate.replace(new RegExp(\${decimalSeparator}, 'i'), '.') - this is new to me.
Also, I don't suggest importing any 3rd parties for this.

@akinwale
Copy link
Contributor

@akinwale thanks for the proposal. I think there should be pattern to parse locale based numeric values in the app. parseFloat(values.rate.replace(new RegExp(${decimalSeparator}, 'i'), '.') - this is new to me. Also, I don't suggest importing any 3rd parties for this.

@situchan There isn't one. The closest thing we have for an amount regex is in the validateAmount method in MoneyRequestUtils.

I believe if there was, then we wouldn't be replacing the locale digit, ',' with a '.'. The methods for doing this were moved in this PR: 5b33d50. Check for the getNumericValue method.

So here, we can use:

const {translate, toLocaleDigit} = useLocalize();
...
if parseFloat(values.rate.replace(toLocaleDigit(.'), '.')) <= 0) {

Additionally, we only need to worry about the decimal separator here. It looks like thousands separators are not supported for the rate input.

@melvin-bot melvin-bot bot added the Overdue label Sep 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

@anmurali @situchan 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
Copy link

melvin-bot bot commented Sep 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 2023

@anmurali, @situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@anmurali
Copy link

anmurali commented Oct 4, 2023

Bumped @situchan on slack again.

@melvin-bot melvin-bot bot added the Weekly KSv2 label Oct 13, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-20] [$500] [iOS] - Workspace - Distance rate separator in Spanish causes errors [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] [iOS] - Workspace - Distance rate separator in Spanish causes errors Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.83-11 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 2023-10-20. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 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:

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 16, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] [iOS] - Workspace - Distance rate separator in Spanish causes errors [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] [iOS] - Workspace - Distance rate separator in Spanish causes errors Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 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 2023-10-23. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 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:

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 16, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] [iOS] - Workspace - Distance rate separator in Spanish causes errors [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] [iOS] - Workspace - Distance rate separator in Spanish causes errors Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 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 2023-10-23. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 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:

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

@allroundexperts
Copy link
Contributor

Checklist

  1. fix: Web - No Error Generated When Adding a Track Distance Rate of 0.00 #26745
  2. https://github.com/Expensify/App/pull/26745/files#r1363618830
  3. This component is rarely used. I think a Slack discussion is not required.
  4. A regression test would be helpful.

Regression test

  1. Login and change the language to Spanish.
  2. Go into workspace settings > reimbursements > track distance
  3. Change rate to anything using comma
  4. Verify that no error occurs.

Do we 👍 or 👎 ?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 20, 2023
@akinwale
Copy link
Contributor

@anmurali Just noting here that the PR was initially deployed to production on 2023-10-13, so the actual payment due date is 2023-10-20. Melvin got confused with a bunch of subsequent deployment issues which happened afterwards.

Thanks.

@melvin-bot melvin-bot bot added the Overdue label Oct 23, 2023
@JmillsExpensify
Copy link

Can I get a payment summary for this issue?

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

@nkuoch, @akinwale, @anmurali, @allroundexperts Whoops! This issue is 2 days overdue. Let's get this updated quick!

@anmurali
Copy link

anmurali commented Oct 24, 2023

@melvin-bot melvin-bot bot removed the Overdue label Oct 24, 2023
@JmillsExpensify
Copy link

$750 payment approved for @allroundexperts based on summary.

@melvin-bot melvin-bot bot added the Overdue label Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@nkuoch, @akinwale, @anmurali, @allroundexperts Huh... This is 4 days overdue. Who can take care of this?

@anmurali
Copy link

anmurali commented Nov 1, 2023

Done.

@anmurali anmurali closed this as completed Nov 1, 2023
@melvin-bot melvin-bot bot removed the Overdue label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants