Skip to content

[HOLD for payment 2023-08-01] [$1000] Web - App does not remove dot from amount in split bill after first try #22361

Closed

Description

@kbecciv

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

Activity

  1. added
    Daily
    Bug
    on Jul 6, 2023
  2. melvin-bot commented on Jul 6, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jul 6, 2023

    @melvin-bot

    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
  4. kushu7 commented on Jul 6, 2023

    @kushu7
    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,
    },
    });
    }

    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

  5. added
    External
    on Jul 6, 2023
  6. 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[/+] on Jul 6, 2023
  7. melvin-bot commented on Jul 6, 2023

    @melvin-bot
  8. added
    Help Wanted
    on Jul 6, 2023
  9. melvin-bot commented on Jul 6, 2023

    @melvin-bot

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

  10. melvin-bot commented on Jul 6, 2023

    @melvin-bot

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

  11. getusha commented on Jul 7, 2023

    @getusha
    Contributor

    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)

  12. manjesh-yadav commented on Jul 7, 2023

    @manjesh-yadav
    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,
                    },
                });```
  13. 22 remaining items

  14. melvin-bot commented on Jul 25, 2023

    @melvin-bot

    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
  15. melvin-bot commented on Jul 25, 2023

    @melvin-bot

    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:
  16. puneetlath commented on Jul 27, 2023

    @puneetlath
    Contributor

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

  17. added
    Daily
    and removed
    Weekly
    on Jul 31, 2023
  18. eVoloshchak commented on Aug 2, 2023

    @eVoloshchak
    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
  19. puneetlath commented on Aug 2, 2023

    @puneetlath
    Contributor

    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!

  20. kushu7 commented on Aug 2, 2023

    @kushu7
    Contributor

    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)

  21. puneetlath commented on Aug 2, 2023

    @puneetlath
    Contributor

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

  22. kushu7 commented on Aug 3, 2023

    @kushu7
    Contributor

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

    @puneetlath I have accepted new offer on upwork. 😇

  23. eVoloshchak commented on Aug 3, 2023

    @eVoloshchak
    Contributor

    @puneetlath, thanks, requested the payment via NewDot🎉

  24. JmillsExpensify commented on Aug 3, 2023

    @JmillsExpensify
    Contributor

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

  25. puneetlath commented on Aug 3, 2023

    @puneetlath
    Contributor

    Great, closing out. Thanks everyone!

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions