mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Memoize result of line items query
No need to fetch twice what we just loaded from DB.
This commit is contained in:
@@ -51,7 +51,7 @@ class ProducerMailer < Spree::BaseMailer
|
||||
end
|
||||
|
||||
def line_items_from(order_cycle, producer)
|
||||
Spree::LineItem.
|
||||
@line_items ||= Spree::LineItem.
|
||||
includes(variant: [:product, { option_values: :option_type }]).
|
||||
from_order_cycle(order_cycle).
|
||||
sorted_by_name_and_unit_value.
|
||||
|
||||
Reference in New Issue
Block a user