-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
[Product Refactor] Move variant unit sizes to variant #12787
[Product Refactor] Move variant unit sizes to variant #12787
Conversation
29d26d0
to
07c2b4e
Compare
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.
Reviewed first half(up to "Prettify javascript").
Sorry lots of comments, mostly just comprehension but I have a few queries as well.
# updating variant doesn't increment saved_count | ||
# expect(product_set.saved_count).to eq 1 |
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.
🤔 Hmm, it probably should..
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.
Indeed, this PR was not the place for it though
spec/javascripts/unit/admin/products/services/option_value_namer_spec.js.coffee
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.
Review in progress:
- Fix DFC supplied product builder
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.
Epic! Great that you improved the code along the way and fixed little things.
I have to admit that I didn't read every line. But it looks pretty robust.
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.
Phew, done!
I have several comments, probably not all of them need changes, but I think some do (whether now or in a follow-up PR).
I will review my own review and mark any required changes with a ±
in the comment.
price = parseFloat(price); | ||
|
||
if (isNaN(price)) { | ||
return null; | ||
} | ||
|
||
return price; |
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.
This code made sense in the beautifully terse coffeescript, but the ugly JS caused me to wonder if this works just as well:
price = parseFloat(price); | |
if (isNaN(price)) { | |
return null; | |
} | |
return price; | |
return parseFloat(price) || null |
It's not 100% the same logic, but the specs should be able to tell us if it matters or not.
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.
I've added some ±
and one ❓ that I think require addressing, can you please check these?
Other comments might be worth addressing too, but I don't consider them blocking.
333e7bc
to
57eee15
Compare
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.
🏅 Awesome, an epic job!
@rioug There's a conflict here, sorry. Could you please have a look? |
d10359a
to
a2c4fd5
Compare
@drummer83 it's now ready to go. |
@rioug, sorry, just created another merge conflict. |
a2c4fd5
to
76cd3e2
Compare
Sorted ! |
Simplecov failed, I think it's because it re ran only the failed jobs, maybe something we need to look into. Anyway, it doesn't block merging. |
Hi @rioug, I'm sorry, I'm getting an error 500 on the /admin/products page on staging AU. I'll move this back to In Progress until fixed. 🙏 |
- make sure the weight is only cleared when needed - make sure the displayed unit is up to date
I disabled Metrics/AbcSize for ensure_standard_variant as I don't think that's hard to understand the code. And utimately it will be removed once product actually becomes optional.
The current spec is useless, but it has been addressed on master
After the product redactor it only checked for the "description" on product, which is actually skipped when doing an update.
Co-authored-by: David Cook <[email protected]>
Client side validation messages depend on the browser's locale, which we have no controll over. Now we just check a message is set.
There is no easy way to make the original product invalid, but we can make sure the cloned product will be invalid. The cloned product add "COPe OF " in front of the product's name, so by starting with a name that's long enough, the cloned product will have a name longer that 255 char and will then be invalid.
Co-authored-by: Maikel <[email protected]>
00b7f24
to
01337c1
Compare
Hey @rioug, I can confirm that this PR introduces the "possibility" to select an empty value from the list; However, it is not possible to save these changes, attempting to do so, triggers the warning below: For comparison, before this PR: This is valid for new and old variants, in the sense that an empty choice is appearing in the UI in both cases. However, all variants have attributed unit values.
Alright, thank you for pointing this out. I'll open an issue on this. Thanks for all the effort and resilience. Merging (finally!) 🎉 |
What? Why?
Last step of the first part of product refactor #9069
Move variant unit sizes to variant :
Review Note:
We should really refactor app/webpacker/controllers/variant_controller.js and app/webpacker/controllers/variant_controller.js to extract anything that's common for the "unit popout". We could probably move it to component. This PR is already big enough so I did not want to do it here.
What should we test?
Anything that touches unit sizes (non exhaustive list), check that unit sizes are displayed properly and can be updated when applicable :
Update variant page, I replaced angular with StimulusJS, beside checking unit sizes check there is no feature loss.
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates