Skip to content

[HOLD for payment 2024-08-01] [$250] Subscription size - Decimal point can be inserted and not removed on the confirmation page #43796

Closed

Description

@lanitochka17

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.4.84-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: N/A
Issue reported by: Applause - Internal Team

Issue found when executing PR #43328

Action Performed:

  1. Go to staging.new.expensify.com/settings/subscription/subscription-size
  2. Enter a digit and a decimal point
  3. Click Next

Expected Result:

Decimal point will be removed on the next page

Actual Result:

Decimal point can be inserted and not removed on the confirmation page

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

Bug6514089_1718444363848.bandicam_2024-06-15_17-37-25-460.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d8c409a169a06c82
  • Upwork Job ID: 1803448780086879493
  • Last Price Increase: 2024-06-19
  • Automatic offers:
    • fedirjh | Reviewer | 102862371
    • Krishna2323 | Contributor | 102862372
Issue OwnerCurrent Issue Owner: @miljakljajic

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 15, 2024
  2. melvin-bot commented on Jun 15, 2024

    @melvin-bot

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

  3. lanitochka17 commented on Jun 15, 2024

    @lanitochka17
    Author

    @miljakljajic 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

  4. Krishna2323 commented on Jun 15, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Subscription size - Decimal point can be inserted and not removed on the confirmation page

    What is the root cause of that problem?

    We haven't added a check for decimal point.

    function isValidSubscriptionSize(subscriptionSize: string): boolean {
    const parsedSubscriptionSize = Number(subscriptionSize);
    return !Number.isNaN(parsedSubscriptionSize) && parsedSubscriptionSize > 0 && parsedSubscriptionSize <= CONST.SUBSCRIPTION_SIZE_LIMIT && Number.isInteger(parsedSubscriptionSize);
    }

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

    Check if the number contains ..

    function isValidSubscriptionSize(subscriptionSize: string): boolean {
        const parsedSubscriptionSize = Number(subscriptionSize);
        if (subscriptionSize.includes('.')) {
            return false;
        }
        return !Number.isNaN(parsedSubscriptionSize) && parsedSubscriptionSize > 0 && parsedSubscriptionSize <= CONST.SUBSCRIPTION_SIZE_LIMIT && Number.isInteger(parsedSubscriptionSize);
    }

    What alternative solutions did you explore? (Optional)

    We can use NUMBER regex.

    function isValidSubscriptionSize(subscriptionSize: string): boolean {
        const parsedSubscriptionSize = Number(subscriptionSize);
        return (
            !Number.isNaN(parsedSubscriptionSize) &&
            parsedSubscriptionSize > 0 &&
            parsedSubscriptionSize <= CONST.SUBSCRIPTION_SIZE_LIMIT &&
            Number.isInteger(parsedSubscriptionSize) &&
            CONST.REGEX.NUMBER.test(subscriptionSize)
        );
    }

    What alternative solutions did you explore? (Optional 2)

    If we don't want to show error when entering 0 after decimal then we need to trim the decimal points on confirmation page.

    title={translate('subscription.subscriptionSize.activeMembers', {size: subscriptionSizeFormDraft ? subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE] : 0})}

    title={translate('subscription.subscriptionSize.activeMembers', {
        size: subscriptionSizeFormDraft ? `${Math.trunc(Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE]))}` : 0,
    })}

    Additionally we should also clear the draft value when saving the subscription size.

    const onFinished = () => {
    Subscription.updateSubscriptionSize(subscriptionSizeFormDraft ? Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE]) : 0, privateSubscription?.userCount ?? 0);
    Navigation.goBack();
    };

    To:

        const onFinished = () => {
            FormActions.clearDraftValues(ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM);
            Subscription.updateSubscriptionSize(subscriptionSizeFormDraft ? Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE]) : 0, privateSubscription?.userCount ?? 0);
            Navigation.goBack();
        };
  5. Krishna2323 commented on Jun 15, 2024

    @Krishna2323
    Contributor

    Proposal Updated

    • Added alternative 1 and 2
  6. melvin-bot commented on Jun 18, 2024

    @melvin-bot

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

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 19, 2024
  8. changed the title [-] Subscription size - Decimal point can be inserted and not removed on the confirmation page[/-] [+][$250] Subscription size - Decimal point can be inserted and not removed on the confirmation page[/+] on Jun 19, 2024
  9. melvin-bot commented on Jun 19, 2024

    @melvin-bot
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 19, 2024
  11. melvin-bot commented on Jun 19, 2024

    @melvin-bot

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

  12. 21 remaining items

  13. melvin-bot commented on Jul 25, 2024

    @melvin-bot

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

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

  14. melvin-bot commented on Jul 25, 2024

    @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:

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

    @miljakljajic
    Contributor

    @Krishna2323 you've been paid in upwork, thank you!

    @fedirjh your original offer expired as you didn't accept it in upwork in time. Please accept the new offer.

  16. miljakljajic commented on Aug 1, 2024

    @miljakljajic
    Contributor

    actually @fedirjh do we pay you in NewDot? I noticed you're listed for manual payments. Let me know and I'll provide a payment summary instead.

  17. fedirjh commented on Aug 2, 2024

    @fedirjh
    Contributor

    do we pay you in NewDot?

    @miljakljajic Yes, that’s correct. Can you provide a summary instead? Thank you

  18. fedirjh commented on Aug 2, 2024

    @fedirjh
    Contributor

    BugZero Checklist:

    • Link to the PR: N/A This could have been caught in feat: Subscription size backend integration #43484
    • Link to comment: N/A
    • Link to discussion: N/A
    • Determine if we should create a regression test for this bug: N/A, this is a minor edge-case bug, no need to add regression tests
  19. miljakljajic commented on Aug 5, 2024

    @miljakljajic
    Contributor

    Of course, apologies.

    @fedirjh is owed 250 for their work reviewing this issue.

  20. JmillsExpensify commented on Aug 5, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @fedirjh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions