mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Reorder conditions for performance
A little micro-optimisation: `@order.checkout_allowed?` requires a database query, whereas `@order.completed?` does not. So in cases where the order is completed we can return early here before hitting the database.
This commit is contained in:
@@ -89,9 +89,7 @@ class CheckoutController < ::BaseController
|
||||
end
|
||||
|
||||
def order_invalid_for_checkout?
|
||||
!@order ||
|
||||
!@order.checkout_allowed? ||
|
||||
@order.completed?
|
||||
!@order || @order.completed? || !@order.checkout_allowed?
|
||||
end
|
||||
|
||||
def valid_order_line_items?
|
||||
|
||||
Reference in New Issue
Block a user