-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add minimum budget limit #2583
base: update/2535-consolidate-ad-creation-ccf-merged
Are you sure you want to change the base?
Add minimum budget limit #2583
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## update/2535-consolidate-ad-creation-ccf-merged #2583 +/- ##
================================================================================
+ Coverage 61.0% 61.6% +0.5%
================================================================================
Files 330 331 +1
Lines 5183 5233 +50
Branches 1254 1268 +14
================================================================================
+ Hits 3162 3221 +59
+ Misses 1832 1820 -12
- Partials 189 192 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@asvinb We need a styling update to the error message shown when a minimum limit is shown to the user. The input box also needs to be updated when in that invalid input state. Can you please take a look? Thanks! |
@joemcgill As part of this work, I extracted the getHighestBudget into a utility.
|
Thanks @dsawardekar. Re:
Let's not update the Paid Ads flow at this time. It should end up getting handled as part of #2535. |
…dd-minimum-budget-limit
@joemcgill This is ready for code review. Note that I needed to create a new mock helper for the budget recommendation, let me know if that needs to be refactored. |
…dd-minimum-budget-limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dsawardekar I left some comments on the PR. Can you kindly check please and let me know what you think?
js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-setup-sections.js
Outdated
Show resolved
Hide resolved
js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-setup-sections.js
Outdated
Show resolved
Hide resolved
@asvinb I've updated the PR per the feedback. Can you take another look? thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dsawardekar Thanks for the updates. I think it's very close to approval. Can you check my latest comments please? Thanks!
js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-setup-sections.js
Outdated
Show resolved
Hide resolved
js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-setup-sections.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asvinb I have one small tweak for this that I'd like to make, but am pre-approving and this can go to QA.
@joemcgill @ankitguptaindia Raised a valid point for when using decimals which is in WooCommerce settings (Settings -> Currency Options -> Number of decimals). Checking @fblascogarma comment where we wish to round the number automatically, I think it'll add unnecessary complexity since we now have to rely on the number of decimals for the currency. I suggest we use don't round up the numbers and instead rely on the user settings for the decimal numbers. If the decimal place is set to |
@asvinb I'm not sure I understand the issue we're running into with rounding. My understanding is that we are only rounding the suggested budget in order to set the minimum value, which is what should then be displayed to users as the minimum value in the error message. We should not be rounding the value that the user has input. I think the text change you suggested makes sense and is more accurate since a value that is === to the minimum should be acceptable. |
Hi @joemcgill and @asvinb, I would like to chip in two questions about the budget validation.
|
…dd-minimum-budget-limit
@joemcgill @eason9487 Let me try to summarize the "issue" with the decimals (although it's not really an issue 😁 ). With the number of decimals set to 0:With the number of decimals set to 1:
With the number of decimals set to 2:
So if we want to use the greater than text, then we must take into account the number of decimal places to do the calculation as well because it'll vary, from |
Thanks for the explanation, @asvinb. I think you're correct (if I'm understanding correctly) that using the store setting to control the decimal rounding likely makes sense. What is still a bit confusing is how this ended up creating a situation like @ankitguptaindia reported here where the minimum budget error shows a number lower than the one the user has actually input. I'm not able to reproduce that error locally. |
@joemcgill Actually the error that @ankitguptaindia reported is no longer applicable because it's now fixed 😁 Previously, i.e when not taking into consideration the Woo number of decimals settings, then you could reproduce the issue. However now it's fixed. I changed the target branch to update/2535-consolidate-ad-creation-ccf-merged and fixed the conflicts and also simplified the code. Can you kindly take a look before I send to QA with all those changes? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for explaining. This tested well for me. Thanks
Thanks @joemcgill . Assigning to @ankitguptaindia for another round of QA. |
Thanks for the fixes, @asvinb. The issues have been resolved, and the minimum budget requirement message is now appearing correctly when the WooCommerce settings have different decimal configurations. Quick Demo: Recording.884.mp4 |
Before starting a new round of code reviews, could you help me clarify the two questions in #2583 (comment)? Using the current 78fc8bb revision and replacing:
with: const minAmount = Math.ceil( dailyBudget * BUDGET_MIN_PERCENT ); Apart from using the greater than wording, It works pretty well and fulfills the rest requirements without the semantic inaccuracies in the error message. Kapture.2024-10-04.at.18.58.34.mp4I have read all the relevant discussions in the PR. However, taking the decimals into account when calculating the minimum budget value still confuses me. |
Hello @eason9487 |
I agree and using "at least" is totally appropriate here and more accurate than the original requirements that I had written for the issue. |
Hi @asvinb
This question should not be related to the word "rounding" and it's not the cause of the confusion. I used
Yes, and the current implementation has already rephrased to |
@eason9487 If we use |
Changes proposed in this Pull Request:
Closes #2503
This PR updates the campaign flow to include validation of minimum daily limits. An error message is shown if the amount is less than the daily limit.
Screenshots:
With an insufficient amount:
With a sufficient amount:
Detailed test instructions:
Additional details:
Update - Enforce the daily limit of 30% in setup your budget section
Changelog entry