Openfoodnetwork: Order Cycles won't create for one specific UK enterprise

Created on 24 Oct 2018  路  14Comments  路  Source: openfoodfoundation/openfoodnetwork

Description

We're having an issue with Grimshaw Community Centre * -

1 - firstly, when trying to duplicate the existing order cycle, we get the error page with the cat - #2764
2 - when we try to create a new order cycle from scratch, at no point are we able to save it. Lynne, Nick and I have looked at the way the enterprise is setup and can't spot any abnormalities.

*Note there are is another enterprise Grimshaw Community Centre 2, it is not this one.

Expected Behavior

The order cycle should save, and be able to duplicate without the cat error

Actual Behavior

We see the cat error when trying to duplicate and existing cycle
When we try to create a new order cycle from scratch, when we click save, we get no notifications as to whether it has saved or not, just blank. When you go back to have a look there is no new order cycle

Steps to Reproduce


  1. Go to order cycles and create a new order cycle
  2. Fill in the details, add a in and out going cycle
  3. Save
  4. Notice no change - errors picked up in console

Animated Gif/Screenshot

http://recordit.co/UO1apQSDzX

Context


User cannot use the order cycle functionality at all.

Severity

Your Environment

  • Version used:
  • Browser name and version: chrome
  • Operating System and version (desktop or mobile): windows

Possible Fix

bug-s3

All 14 comments

could this be connected to https://github.com/openfoodfoundation/openfoodnetwork/issues/2676 and similar issue on german instance. Not sure what version you are running and whether the fix is in, but it is possible that someone has deleted a User and/or there is a failed job somewhere that is preventing the OC from being created. Which (perhaps) is also affecting the duplication. If you can get someone (@Matt-Yorkley @lin-d-hop @mkllnk @sauloperez @luisramos0 ) to check and remove any _failing jobs_ that might give you a quick fix

I had a look into the log files and when trying to clone an order cycle it says:

Started GET "/admin/order_cycles/202161/clone" for 182.239.201.161 at 2018-10-25 04:39:44 +0000
Processing by Admin::OrderCyclesController#clone as HTML
  Parameters: {"id"=>"202161"}
Completed 422 Unprocessable Entity in 349.8ms (ActiveRecord: 107.7ms)
** [Bugsnag] Notifying https://notify.bugsnag.com of ActiveRecord::RecordInvalid from api_key 3b460c1fe92a0c7703e73c8fb854b388

ActiveRecord::RecordInvalid (Validation failed: Variants unit value can't be blank):
  app/models/exchange.rb:64:in `clone!'
  app/models/order_cycle.rb:131:in `block in clone!'
  app/models/order_cycle.rb:131:in `clone!'
  app/controllers/admin/order_cycles_controller.rb:74:in `clone'

So somehow there is an invalid variant (missing unit value) and that's why it can't be cloned. Oh, not quite. There is one more clone now, just without variants in there.

Creating a new order cycle doesn't give as much information:

Started POST "/admin/order_cycles.json" for 182.239.201.161 at 2018-10-25 04:54:59 +0000
Processing by Admin::OrderCyclesController#create as JSON
  Parameters: {"order_cycle"=>{"incoming_exchanges"=>[{"enterprise_id"=>"200527", "incoming"=>true, "active"=>true, "variants"=>{"211911"=>true, "211913"=>true, "211915"=>true, "211917"=>true, "211919"=>true, "211921"=>true, "211923"=>true, "211925"=>true, "211927"=>true, "211929"=>true, "211931"=>true, "211933"=>true, "211935"=>true, "211939"=>true, "211941"=>true, "211943"=>true, "211945"=>true, "211947"=>true, "211949"=>true, "211951"=>true, "211953"=>true, "211955"=>true, "211957"=>true, "211959"=>true, "211961"=>true, "211963"=>true, "211967"=>true, "211969"=>true, "211971"=>true, "211973"=>true, "211975"=>true, "211977"=>true, "211979"=>true, "211981"=>true, "211983"=>true, "211985"=>true, "211987"=>true, "211989"=>true, "212363"=>true, "212365"=>true, "212367"=>true, "212369"=>true, "212371"=>true, "212373"=>true, "212524"=>true, "212526"=>true, "212528"=>true, "212637"=>true, "212639"=>true, "212755"=>true, "212863"=>true, "213125"=>true, "213127"=>true, "213897"=>true, "215081"=>true, "215083"=>true, "215085"=>true, "215779"=>true, "216120"=>true, "216168"=>true, "216170"=>true, "216287"=>true, "216386"=>true, "216388"=>true, "216465"=>true, "216624"=>true, "216838"=>true, "216997"=>true, "216999"=>true, "217001"=>true, "217003"=>true, "217205"=>true, "217207"=>true, "217281"=>true, "217283"=>true, "217285"=>true, "217287"=>true, "217289"=>true, "217347"=>true, "217635"=>true, "217957"=>true, "218176"=>true, "218270"=>true, "219163"=>true, "219165"=>true, "220110"=>true, "220284"=>true}, "select_all_variants"=>true, "enterprise_fee_ids"=>nil}], "outgoing_exchanges"=>[{"enterprise_id"=>"200346", "incoming"=>false, "active"=>true, "variants"=>{"211911"=>false, "211913"=>false, "211915"=>false, "211917"=>false, "211919"=>false, "211921"=>false, "211923"=>false, "211925"=>false, "211927"=>false, "211929"=>false, "211931"=>false, "211933"=>false, "211935"=>false, "211939"=>false, "211941"=>false, "211943"=>false, "211945"=>false, "211947"=>false, "211949"=>false, "211951"=>false, "211953"=>false, "211955"=>false, "211957"=>false, "211959"=>false, "211961"=>false, "211963"=>false, "211967"=>false, "211969"=>false, "211971"=>false, "211973"=>false, "211975"=>false, "211977"=>false, "211979"=>false, "211981"=>false, "211983"=>false, "211985"=>false, "211987"=>false, "211989"=>false, "212363"=>false, "212365"=>false, "212367"=>false, "212369"=>false, "212371"=>false, "212373"=>false, "212524"=>false, "212526"=>false, "212528"=>false, "212637"=>false, "212639"=>false, "212755"=>false, "212863"=>false, "213125"=>false, "213127"=>false, "213897"=>false, "215081"=>false, "215083"=>false, "215085"=>false, "215779"=>false, "216120"=>false, "216168"=>false, "216170"=>false, "216287"=>false, "216386"=>false, "216388"=>false, "216465"=>false, "216624"=>false, "216838"=>false, "216997"=>false, "216999"=>false, "217001"=>false, "217003"=>false, "217205"=>false, "217207"=>false, "217281"=>false, "217283"=>false, "217285"=>false, "217287"=>false, "217289"=>false, "217347"=>false, "217635"=>false, "217957"=>false, "218176"=>false, "218270"=>false, "219163"=>false, "219165"=>false, "220110"=>false, "220284"=>false}, "select_all_variants"=>false, "pickup_time"=>"now", "enterprise_fee_ids"=>nil}], "name"=>"Maikel's test", "orders_open_at"=>"2018-10-11 00:00:00", "orders_close_at"=>"2018-10-18 00:00:00", "coordinator_id"=>200346, "schedule_ids"=>nil, "coordinator_fee_ids"=>nil}}
Completed 422 Unprocessable Entity in 805.4ms (Views: 0.3ms | ActiveRecord: 299.4ms)

I found a workaround:

  • Create an order cycle without products.
  • Edit the order cycle and add products.
  • Click "Update" and it should save.

There seems to be an issue with validating the variants when first creating an order cycle. We need to investigate which data is causing this issue and what the cause is.

Since there is a workaround and only very few users are affected, I'm degrading this issue to S3. I'm also unassigning myself, because I will move on to the next S2.

Hi, can I get some kind of access to uk live so I can try to replicate and fix?
My user is luisramos0 a_t gmail
Thanks.

@luisramos0 I've added you as a manager of the Grimshaw enterprise which is the one we're seeing the issues with. Is that what you're after?

yes, I can replicate now. thank you!

The problem is not in Grimshaw Community Centre, it's in Growing with Nature. I can create an order cycle with all products from all other producers. The error only occurs with products from "Growing with Nature". There's something wrong with the products of Growing with Nature or with the relationship defined between "Growing with Nature" and "Grimshaw Community Centre".

Another detail is that "Growing with Nature" is the only one for which "Grimshaw Community Centre" has some Inventory entries (VariantOverrides).

ok, I found the product with the problem: it's "PEPPER, RED (EUR)" from "Growing with Nature".
I created an OC with all products except this one and it works.
One fix I'd try is to add this product to the "Grimshaw Community Centre" inventory but before that I think we should try to discover what's wrong with this product. I don't have access to manage "Growing with Nature" and I cant access the server.
Can you look at it and see if something different?

@sineadfenton 鈽濓笍

Thanks @luisramos0
The problem was that the product was somehow specified both as a weight and as an item. I updated this product and everything seems to be working.
It seems this is possible when a product is sold as 'Items' but the user enters a weight in the variant edit screen. This is a bug and needs a separate issue and some specification.

@lin-d-hop nice, thanks.
do you keep that tasks of creating the issue? do you want me to create the issue?

I've got it on my todo list @luisramos0. Might take me a little while to get to it so let me know if you get to it first :-)

Was this page helpful?
0 / 5 - 0 ratings