openfoodnetwork
openfoodnetwork copied to clipboard
Snail on viewing order without shipping method
Description
I'm not sure if the shipping method was deleted or if we don't handle soft-deletion well. But someone tried to view an order that didn't seem to have a shipping method and that failed.
Expected Behavior
An order can always be viewed. And ideally, we would see the shipping information from the time the order was last updated.
Actual Behaviour
The shipping method can disappear and that makes it impossible to view the order.
Steps to Reproduce
- ???
Animated Gif/Screenshot
Workaround
Never delete shipping methods that have been used.
Severity
bug-s1: a critical feature is broken: checkout, payments, signup, login bug-s2: a non-critical feature is broken, no workaround bug-s3: a feature is broken but there is a workaround bug-s4: it's annoying, but you can use it bug-s5: we can live with it, only a few users impacted
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Bug-severity
Your Environment
- Version used:
- Browser name and version:
- Operating System and version (desktop or mobile):
Possible Fix
The easiest is to not render shipping information when it's not there. Then you can at least view the rest of the order. But then we should find out how the shipping method can disappear and prevent it.
Error in OpenFoodNetwork
ActionView::Template::Error in spree/orders#show undefined method `name' for nil:NilClass
Stacktrace
app/views/spree/shared/_shipment_pickup_details.html.haml:2 - _app_views_spree_shared__shipment_pickup_details_html_haml___1526812528892918037_46948086630260
app/views/spree/shared/_order_details.html.haml:35 - _app_views_spree_shared__order_details_html_haml___3083868958160601114_46948087253380
app/views/spree/orders/show.html.haml:28 - _app_views_spree_orders_show_html_haml___2385709996876932168_46948104694280
Created by Maikel via Bugsnag
Although not very common, it does seem to be happening on other servers as well:
Bugsnag Katuma https://openfoodnetwork.slack.com/archives/C2GQ45KNU/p1650623850408289?thread_ts=1650572645.799509&cid=C2GQ45KNU
Bugsnag DE https://app.bugsnag.com/yaycode/open-food-network-germany/errors/62424701f1ce2c0009ab2597?event_id=624247010092e7729c1a0000&i=sk&m=nw&pivot_tab=event
Bugsnag UK https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/61f7a5e1588013000802d818?filters[event.since]=30d&filters[app.release_stage]=production&filters[error.status]=open&filters[search][]=ActionView%3A%3ATemplate%3A%3AError&filters[search][]=spree%2Forders%23show&event_id=623b3c6e0092eb93b5440000
cc/ @eugenichafer
We have removed the ability to view cancelled orders completely in #9390. Maybe this issue can be closed?
BUT: I have found one way to create orders without shipping methods - I think this was a puzzle? It seems to happen in the following scenario:
- Have an order in states shipment: pending and payment: balance due
- On edit order page delete all items one by one
- After deleting the last item and confirming to cancel the order you will have shipment: --- and payment: void