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-08-01] [$250] Subscription size - Decimal point can be inserted and not removed on the confirmation page #43796

Closed
3 of 6 tasks
lanitochka17 opened this issue Jun 15, 2024 · 24 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 Jun 15, 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: 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
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 15, 2024
Copy link

melvin-bot bot commented Jun 15, 2024

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.

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jun 15, 2024

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();
    };

@Krishna2323
Copy link
Contributor

Proposal Updated

  • Added alternative 1 and 2

@melvin-bot melvin-bot bot added the Overdue label Jun 17, 2024
Copy link

melvin-bot bot commented Jun 18, 2024

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

@miljakljajic miljakljajic added the External Added to denote the issue can be worked on by a contributor label Jun 19, 2024
@melvin-bot melvin-bot bot 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 Jun 19, 2024
Copy link

melvin-bot bot commented Jun 19, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 19, 2024
Copy link

melvin-bot bot commented Jun 19, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jun 19, 2024
@fedirjh
Copy link
Contributor

fedirjh commented Jun 24, 2024

@Krishna2323 In my opinion, the correct solution would be the alternative option 2, which involves making updates to the confirmation page. We can make a small improvement by extracting the size draft value, formatting it, and then using it in the component.

const subscriptionSizeDraft = Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE])

@Krishna2323's Alternative solution option 2 looks good to me

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jun 24, 2024

Triggered auto assignment to @AndrewGable, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

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

Offer link
Upwork job

Copy link

melvin-bot bot commented Jun 24, 2024

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

Offer link
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 📖

@fedirjh
Copy link
Contributor

fedirjh commented Jun 26, 2024

@Krishna2323 when can we expect a PR?

@Krishna2323
Copy link
Contributor

Will raise the PR today.

@Krishna2323
Copy link
Contributor

@fedirjh PR ready for review ^

@fedirjh
Copy link
Contributor

fedirjh commented Jul 22, 2024

PR merged.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 25, 2024
@melvin-bot melvin-bot bot changed the title [$250] Subscription size - Decimal point can be inserted and not removed on the confirmation page [HOLD for payment 2024-08-01] [$250] Subscription size - Decimal point can be inserted and not removed on the confirmation page Jul 25, 2024
Copy link

melvin-bot bot commented Jul 25, 2024

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

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

melvin-bot bot commented Jul 25, 2024

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:

Copy link

melvin-bot bot commented Jul 25, 2024

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:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jul 31, 2024
@miljakljajic
Copy link
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.

@melvin-bot melvin-bot bot removed the Overdue label Aug 1, 2024
@miljakljajic
Copy link
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.

@fedirjh
Copy link
Contributor

fedirjh commented Aug 2, 2024

do we pay you in NewDot?

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

@fedirjh
Copy link
Contributor

fedirjh commented Aug 2, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Aug 5, 2024
@miljakljajic
Copy link
Contributor

Of course, apologies.

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

@melvin-bot melvin-bot bot removed the Overdue label Aug 5, 2024
@JmillsExpensify
Copy link

$250 approved for @fedirjh

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

6 participants