-
-
Notifications
You must be signed in to change notification settings - Fork 724
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
[BUU] Stock settings selection is lost, if there are errors on saving #12569
Comments
Hello @filipefurtad0 , May I work on this issue ? |
Hello @dacook , I have a problem here. openfoodnetwork/app/services/sets/product_set.rb Lines 122 to 141 in 25d375b
But creating variants must be done without on_hand & on_demand (a prior stock item must exist). I could pass back the parameters to the view, but it could be a bit cumbersome. What are you thoughts on this ? (I might be missing on something) |
I just had a look at this, and found the problem exists on the I think it's a rare case. It doesn't seem likely that there will be an error on the new variant. Possible errors:
|
@cyrillefr to fix it, I think we could make Eg the setter |
Hello @dacook , # @raise [StandardError] when the variant has no stock item yet
def on_demand=(new_value)
raise_error_if_no_stock_item_available Should I get rid of the raise ? |
Good point. It's a bit confusing, it looks like we're assigning an attribute (with To do that I think we can:
So in the case of an error on the variant, the |
Your solution sounds good, using standard attributes that get saved later. But it's also risky because a lot of logic depends on it and we may introduce new severe bugs trying to solve an s4 bug. That's not a reason not to do it. I'm just flagging it so that we don't rush the solution. |
Description
Follow-up from #12553.
On the products page, when creating a new variant, the stock options are lost, if there are errors on the form, and the user hits Save changes.
Expected Behavior
If some stock options were already selected, these should be kept, even when there are errors on the form, when saving.
Actual Behaviour
The selected stock options are not kept, when there are errors on the form, when saving.
Steps to Reproduce
Animated Gif/Screenshot
After hitting Save changes:
Workaround
Fill in the stock options again
Severity
More of a usability issue?
bug-s4: it's annoying, but you can use it
Your Environment
Possible Fix
The text was updated successfully, but these errors were encountered: