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-08-01] [$1000] Web - App does not remove dot from amount in split bill after first try #22361

Closed
1 of 6 tasks
kbecciv opened this issue Jul 6, 2023 · 31 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

@kbecciv
Copy link

kbecciv commented Jul 6, 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. Open the app
  2. Click on + and click on split bill
  3. Enter any amount and write decimal dot (eg. 1234.)
  4. Click on next and select any users
  5. Click on back twice and observe that normally app removes the dot from the end of amount
  6. Again change the amount or keep the amount the same and write dot in the end.
  7. Again select any users or keep the already selected user and click on next
  8. Go back twice and observe that app no longer removes dot from the amount

Expected Result:

App should remove the dot from the amount if user has not inserted any digit after it.

Actual Result:

App does not removes the dot from the amount when we edit the amount second time even if no digit has been inserted after it.

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: 1.3.37-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

dot.is.not.removed.from.the.amount.mov
Recording.3461.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1688631197920759

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01516b47bd364f3b33
  • Upwork Job ID: 1677044876093419520
  • Last Price Increase: 2023-07-06
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 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

@kushu7
Copy link
Contributor

kushu7 commented Jul 6, 2023

Proposal

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

App does not remove dot from amount in split bill after first try

What is the root cause of that problem?

if (prevProps.iou.amount !== this.props.iou.amount) {
const selectedAmountAsString = this.props.iou.amount ? CurrencyUtils.convertToWholeUnit(this.props.iou.currency, this.props.iou.amount).toString() : '';
this.setState({
amount: selectedAmountAsString,
selection: {
start: selectedAmountAsString.length,
end: selectedAmountAsString.length,
},
});
}

Problem is here when amount is same. we do not update amount state variable.
it will work fine like if we keep changing amount like, 123. goto Next again go to amount page change amount 1234.. you will see it work as expected. as prevProps.iou.amount !== this.props.iou.amount this condition will become true.

but when we again add . to old amount, our condition will become false. and we can see . is still there.

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

Instead of relying on just iou amount changes. we should update state amount variable in navigateToNextPage function. this way our component will have formatted amount value.

const amountInSmallestCurrencyUnits = CurrencyUtils.convertToSmallestUnit(this.state.selectedCurrencyCode, Number.parseFloat(this.state.amount));
IOU.setMoneyRequestAmount(amountInSmallestCurrencyUnits);
IOU.setMoneyRequestCurrency(this.state.selectedCurrencyCode);
if (this.isEditing) {

we can add this here on Line 404

this.setState((prevState)=>{
    const amountAsString = CurrencyUtils.convertToWholeUnit(prevState.selectedCurrencyCode, amountInSmallestCurrencyUnits).toString() || ''
    return {
        amount:amountAsString, 
        selection: { 
            start: amountAsString.length, 
            end: amountAsString.length, 
        }, 
    }
})
Video
Untitled.mov

What alternative solutions did you explore? (Optional)

None

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Jul 6, 2023
@melvin-bot melvin-bot bot changed the title Web - App does not remove dot from amount in split bill after first try [$1000] Web - App does not remove dot from amount in split bill after first try Jul 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

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

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

melvin-bot bot commented Jul 6, 2023

Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

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

@getusha
Copy link
Contributor

getusha commented Jul 7, 2023

Proposal

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

What is the root cause of that problem?

const selectedAmountAsString = this.props.iou.amount ? CurrencyUtils.convertToWholeUnit(this.props.iou.currency, this.props.iou.amount).toString() : '';

the above code eventually will parse the amount to number and convert it to string, which will make sure the amount in string is correct, but when we do not change the value it won't be called, this will have a straightforward fix.

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

We should parse the amount to number and convert it to string, for example:

parseFloat("11.").toString() === "11"
parseFloat("11.1").toString() === "11.1"

inside navigateToNextPage we should add the following to make sure the value is parsed as the right number and converted to a string. that's the only thing convertToWholeUnit did to set the value without the .

this.setState({amount: parseFloat(this.state.amount).toString()})

We also have to set the selection state according to the updated amount.

Screen.Recording.2023-07-07.at.7.10.21.AM.mov

What alternative solutions did you explore? (Optional)

@manjesh-yadav
Copy link
Contributor

Proposal

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

App does not remove dot from amount in split bill after first try

What is the root cause of that problem?

if (prevProps.iou.amount !== this.props.iou.amount) {
const selectedAmountAsString = this.props.iou.amount ? CurrencyUtils.convertToWholeUnit(this.props.iou.currency, this.props.iou.amount).toString() : '';
this.setState({
amount: selectedAmountAsString,
selection: {
start: selectedAmountAsString.length,
end: selectedAmountAsString.length,
},
});
}

  1. We parse the amount to the number and convert it to a string
  2. when we add a dot again, the old amount and the new amount is the same after parsing, and our condition will become false the state is not updated and we can see the dot is still there

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

When we navigate to navigateToNextPage we should parse it again to convert into string and set the right cursor position

const amountAsString = Number(this.state.amount).toString()
this.setState({
                amount: amountAsString,
                selection: {
                    start: amountAsString.length,
                    end: amountAsString.length,
                },
            });```

@getusha
Copy link
Contributor

getusha commented Jul 7, 2023

@manjesh-yadav i proposed parsing and converting to string above

@melvin-bot melvin-bot bot added the Overdue label Jul 10, 2023
@eVoloshchak
Copy link
Contributor

Reviewing proposals today

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2023
@eVoloshchak
Copy link
Contributor

eVoloshchak commented Jul 10, 2023

That is an interesting bug🧐
The proposals are quite similar, I think we should proceed with @kushu7's proposal since that was the first proposal to identify the root cause and propose a fix

🎀👀🎀 C+ reviewed!
cc: @puneetlath

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

melvin-bot bot commented Jul 11, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 11, 2023

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

Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Jul 11, 2023

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

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
Copy link

melvin-bot bot commented Jul 11, 2023

📣 @dhanashree! 📣
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. 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.
  2. 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.
  3. 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>

@melvin-bot
Copy link

melvin-bot bot commented Jul 11, 2023

The BZ member will need to manually hire dhanashree for the Reporter role. Please store your Upwork details and apply to our Upwork job so this process is automatic in the future!

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jul 12, 2023
@kushu7
Copy link
Contributor

kushu7 commented Jul 12, 2023

@eVoloshchak PR is ready for review.

cc @puneetlath

@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

@puneetlath, @eVoloshchak, @kushu7 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@eVoloshchak
Copy link
Contributor

@kbecciv, @puneetlath is OOO, is there a way we can reassign an engineer to review the PR? Or should we just put this on hold?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jul 25, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Web - App does not remove dot from amount in split bill after first try [HOLD for payment 2023-08-01] [$1000] Web - App does not remove dot from amount in split bill after first try Jul 25, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.44-2 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-08-01. 🎊

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.

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

  • @eVoloshchak does not require payment (Eligable for Manual Requests)
  • @kushu7 requires payment

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 Jul 25, 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.
  • [@puneetlath] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@puneetlath
Copy link
Contributor

@eVoloshchak friendly reminder about the checklist ahead of next week.

@eVoloshchak
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Refactor iou page by separating each step as individual screen #17964
  • 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/17964/files#r1282100858
  • 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: This is a simple visual bug, I don't think an additional discussion is needed
  • 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

    The bug has almost zero impact, doesn't affect the user experience at all, I think a regression test isn't needed here

@puneetlath
Copy link
Contributor

puneetlath commented Aug 2, 2023

Issue reporter: @dhanashree-sawant $250 (paid via Upwork)
Contributor: @kushu7 $1000 (paid via Upwork)
Contributor+: @eVoloshchak $1500 (to be NewDot)

@eVoloshchak can you please request payment on NewDot and then comment here once you have? Thanks!

@kushu7
Copy link
Contributor

kushu7 commented Aug 2, 2023

Contributor: @kushu7 $1000 (paid via Upwork)

Hello @puneetlath , It seems a speed bonus may be applicable here, as the pull request was ready to merge within 2 daysbut you were OOO. I also experienced a similar case in the past: #20973 (comment)

@puneetlath
Copy link
Contributor

Ah yes, right you are. I'll amend.

@kushu7
Copy link
Contributor

kushu7 commented Aug 3, 2023

Ah yes, right you are. I'll amend.

@puneetlath I have accepted new offer on upwork. 😇

@eVoloshchak
Copy link
Contributor

@puneetlath, thanks, requested the payment via NewDot🎉

@JmillsExpensify
Copy link

Reviewed details for @eVoloshchak. These details are accurate based on summary from Business Reviewer and are now approved for payment in NewDot.

@puneetlath
Copy link
Contributor

Great, closing out. Thanks everyone!

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
None yet
Development

No branches or pull requests

7 participants