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 2024-12-07] [$250] Distance - Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate #49929

Open
6 tasks done
lanitochka17 opened this issue Sep 30, 2024 · 47 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 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 30, 2024

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.41-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Distance rates
  3. Click on any distance rate
  4. Change the distance rate to 4-digit decimal value (non-zero) and save it
  5. Go to workspace chat
  6. Click + > Submit expense > Distance
  7. Enter waypoints and proceed to confirmation page
  8. Click Rate
  9. Select the 4-digit decimal value rate in Step 4
  10. Note that the rate list only shows 3 decimal value instead of 4
  11. Submit the distance expense
  12. Go to transaction thread and open the receipt
  13. Note that the expense preview and distance receipt shows the complete rate which is 4-digit decimal value

Expected Result:

In Step 10, the rate list should show the complete decimal value (eg, 1.2345)

Actual Result:

In Step 10, the rate list only shows 3 decimal value (eg, 1.234)
In Step 13, the expense preview and distance receipt shows 4 decimal value which is the complete rate (eg, 1.2345)
The rate format is not consistent in the rate list and distance receipt

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

Bug6618594_1727539618646.20240929_000027.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021841311378926667676
  • Upwork Job ID: 1841311378926667676
  • Last Price Increase: 2024-10-09
  • Automatic offers:
    • allgandalf | Contributor | 104470034
Issue OwnerCurrent Issue Owner: @kadiealexander / @kadiealexander
Issue OwnerCurrent Issue Owner: @puneetlath / @kadiealexander
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 30, 2024
Copy link

melvin-bot bot commented Sep 30, 2024

Triggered auto assignment to @kadiealexander (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.

@lanitochka17
Copy link
Author

@kadiealexander FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@NJ-2020
Copy link
Contributor

NJ-2020 commented Sep 30, 2024

Proposal

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

Distance - Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate

What is the root cause of that problem?

Right here the Rate Decimal for displaying Rate is 3 which is wrong

App/src/CONST.ts

Line 2402 in 0e3b82c

RATE_DECIMALS: 3,

And same here
const fixedDecimalPoints = decimalPart.length > 2 && !decimalPart.endsWith('0') ? 3 : 2;

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

We should change it to 4

Result

Screen.Recording.2024-09-30.at.07.00.01.mov

What alternative solutions did you explore? (Optional)

@abzokhattab
Copy link
Contributor

i think this is caused by this PR

@thelullabyy
Copy link
Contributor

Proposal

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

We have an inconsistency in the number of decimal places for the distance rate.

What is the root cause of that problem?

In this PR #49773, we decided to always display 4 decimals for all currencies. But we haven't updated this function getRateDisplayValue function.

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

Update to display 4 decimals

return Number(numValue).toFixed(fixedDecimalPoints).toString().replace('.', toLocaleDigit('.'));

        return Number(numValue).toFixed(CONST.MAX_TAX_RATE_DECIMAL_PLACES).toString().replace('.', toLocaleDigit('.'));

return numValue.toFixed(CONST.CUSTOM_UNITS.RATE_DECIMALS);

       return numValue.toFixed(CONST.MAX_TAX_RATE_DECIMAL_PLACES);

I see one more edge case when rate is 166.9800 (There are some zeros in the end), should we display zeros? Currently, we also display inconsistency in this case

  1. If yes, (we need to update how we display rates in the money request flow)

return numValue.toString().replace('.', toLocaleDigit('.')).substring(0, value.toString().length);

Remove .substring(0, value.toString().length);

  1. If no, (we need to update how we display rates distance rate page)

minimumFractionDigits: CONST.MAX_TAX_RATE_DECIMAL_PLACES,

        minimumFractionDigits: 2,
        maximumFractionDigits: 4,

Another problem in the update rate message, the rate only display 2 decimals. But this data is get from originalMessage. If we want to update it, we need to fix on the BE side or make a workaround on FE (detail later if needed)

Screenshot 2024-10-01 at 10 48 19

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Oct 1, 2024

📣 @thelullabyy! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

Copy link

melvin-bot bot commented Oct 1, 2024

⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

Copy link

melvin-bot bot commented Oct 1, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@kadiealexander kadiealexander added External Added to denote the issue can be worked on by a contributor Hourly KSv2 labels Oct 2, 2024
@melvin-bot melvin-bot bot changed the title Distance - Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate [$250] Distance - Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate Oct 2, 2024
@kadiealexander kadiealexander removed the Daily KSv2 label Oct 2, 2024
Copy link

melvin-bot bot commented Oct 2, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 2, 2024
@kadiealexander kadiealexander added the Daily KSv2 label Oct 2, 2024
Copy link

melvin-bot bot commented Oct 2, 2024

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

@parasharrajat
Copy link
Member

This seems like a regression from #49773. cc: @DylanDylann @daledah

@DylanDylann
Copy link
Contributor

@parasharrajat Hmm, In #49773, we decided to mirror the Olddot behavior and always use a 4-digit decimal on the rate value.

About this bug, I think this is a new requirement for the update distance rate on the request money flow to use of 4-digit decimals, because this issue also happens on the Olddot

Screen.Recording.2024-10-03.at.10.59.06.mov

@DylanDylann
Copy link
Contributor

I just glanced at proposals and noticed that @thelullabyy mentioned a valuable point

I see one more edge case when rate is 166.9800 (There are some zeros in the end), should we display zeros? Currently, we also display inconsistency in this case

@parasharrajat
Copy link
Member

Ok. thanks for the input. let me review the proposals in that case.

@ChavdaSachin
Copy link
Contributor

ChavdaSachin commented Oct 5, 2024

Edited by proposal-police: This proposal was edited at 2024-10-05 23:59:46 UTC.

Proposal

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

Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate

What is the root cause of that problem?

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

  • First update RATE_DECIMALS: 4

    App/src/CONST.ts

    Line 2411 in 99f280b

    RATE_DECIMALS: 3,
  • Now update fixedDecimalPoints logic here, based on if we want to hide appending zeroes or not.
    const fixedDecimalPoints = decimalPart.length > 2 && !decimalPart.endsWith('0') ? 3 : 2;
  • An additional problem we face after such update is for currency which do not support decimals.(ex. ALL)
check this video

parameter: currency- ALL, rate-0.6799, distance-74.59mil, from New York to New Jersey.

Screen.Recording.2024-10-06.at.5.07.35.AM.mov
  • When we display amount on report page we roundoff the amount according to currency. but when we try to edit the amount, edit amount page actually rips off the digits after decimal points for currencies which do not support decimals. which causes inconsistency between amount displayed on report page and amount displayed on edit amount page.

To solve this problem we need to start rounding off amount on IOUStepAmount instead of ripping of the digits after decimal point.

        setNewAmount(Number(currentAmount).toFixed());

setNewAmount(MoneyRequestUtils.stripDecimalsFromAmount(currentAmount));

And some cleanup.

And need some additional changes from BE, the generated message when changing distance rate only has 3 decimal places so BE now need to return amount with 4 decimal places.
Screenshot 2024-10-06 at 5 29 06 AM

Optional
Generally we store amount value by multiplying it with 100 to avoid storing floating values, for the same reason we should start to store rate amount by multiplying it with 10000 and make a workflow around.

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.

@melvin-bot melvin-bot bot added the Overdue label Oct 5, 2024
Copy link

melvin-bot bot commented Oct 7, 2024

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

@kadiealexander
Copy link
Contributor

@parasharrajat bump on the reviews!

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 13, 2024
Copy link

melvin-bot bot commented Nov 13, 2024

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

Copy link

melvin-bot bot commented Nov 13, 2024

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

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

Copy link

melvin-bot bot commented Nov 13, 2024

@parasharrajat / @allgandalf @puneetlath / @kadiealexander @parasharrajat / @allgandalf The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@allgandalf
Copy link
Contributor

@thelullabyy when can we expect the new PR?

@thelullabyy
Copy link
Contributor

@allgandalf I'll open the PR today.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Weekly KSv2 labels Nov 15, 2024
@thelullabyy
Copy link
Contributor

@allgandalf PR is ready for review.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 19, 2024
@allgandalf
Copy link
Contributor

Please remove the hold for payment label, the new PR is still in works

@puneetlath puneetlath changed the title [HOLD for payment 2024-11-20] [$250] Distance - Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate [$250] Distance - Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate Nov 20, 2024
@allgandalf
Copy link
Contributor

Update: New PR should get merged this week

@allgandalf
Copy link
Contributor

Update: PR was merged

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Nov 30, 2024
@melvin-bot melvin-bot bot changed the title [$250] Distance - Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate [HOLD for payment 2024-12-07] [$250] Distance - Rate on confirmation page shows 3 decimal value for a 4-digit decimal value rate Nov 30, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 30, 2024
Copy link

melvin-bot bot commented Nov 30, 2024

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

Copy link

melvin-bot bot commented Nov 30, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.68-7 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-12-07. 🎊

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

Copy link

melvin-bot bot commented Nov 30, 2024

@parasharrajat / @allgandalf @puneetlath / @kadiealexander @parasharrajat / @allgandalf The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
@kadiealexander kadiealexander added Daily KSv2 and removed Weekly KSv2 labels Dec 12, 2024
@melvin-bot melvin-bot bot removed the Overdue label Dec 12, 2024
@kadiealexander
Copy link
Contributor

Payments due (50% reduction due to regression):

@allgandalf or @parasharrajat please complete the checklist!

@parasharrajat
Copy link
Member

Payment requested for #49929 (comment)

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 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Status: Polish
Development

No branches or pull requests

10 participants