The Order Cycle Management -> Payments Methods report loads all orders before even loading the filter/search page.
To find Payments Methods it uses a line:
pm = o.payments.first.payment_method -> payment.first is nil
If ONE order that is available to the user from ANY of their enterprises fails to find a payment method then the whole page crashes - 500Error:
undefined methodpayment_method' for nil:NilClass`
Bugsnag: https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/5ea17c7622a1830018e1f834?filters[event.since][0]=30d&filters[error.status][0]=open
Since the system allows an order without a payment (?) we need this report to run regardless.
The report, ya know, works.
SLUG
I have not been able to track down the enterprise that this order is associated with yet - but ther user [email protected] is associated with it. This user is the one I use for all reports integrations.
bug-s2: a non-critical feature is broken, no workaround
From @luisramos0 on Slack:
Should be very easy to address (like this o.payments.first&.payment_method)
is this the same thing? https://github.com/openfoodfoundation/openfoodnetwork/issues/4977
@kirstenalarsen Well what I understand is that in @lin-d-hop 's case it's a super user that has the problem and not one enterprise in particular, which makes it difficult to find the order causing this.
That's the difference I see between the two. But maybe I've missunderstood.
Definitely not related to #4977.
Payment Totals report is not the Order Cycle Management -> Payment Methods report.
@lin-d-hop it's not the same report, but I think it is the same cause: some corrupt data.
Could well be related and due to an order not having a payment associated:
From Payments Report code ->
payments.first.payment_method.name
The key difference is that the data is loaded before the page renders so the corrupted order makes the page totally unusable for any user associated with the order.
Hey team, I'm hoping this can get into the next release please?
It made it to test ready so it should be tested by today or tomorrow