Sha256: 434cc56f368590e8e8bb178a60280cfa8da3bf6fed84c85089c8aa78d650dc59
Contents?: true
Size: 1.11 KB
Versions: 34
Compression:
Stored size: 1.11 KB
Contents
module Workarea module Admin class FulfillmentViewModel < ApplicationViewModel def order options[:order] || OrderViewModel.wrap(Order.find(model.id)) end def packages @packages ||= model.packages.map do |package| PackageViewModel.new(package, order: order) end end def pending_items @pending_items ||= model.pending_items.map do |fulfillment_item| next unless order_item = order .items .detect { |i| i.id.to_s == fulfillment_item.order_item_id } FulfillmentItemViewModel.new( order_item, quantity: fulfillment_item.quantity_pending ) end.compact end def cancellations @cancellations ||= model.canceled_items.map do |fulfillment_item| next unless order_item = order .items .detect { |i| i.id.to_s == fulfillment_item.order_item_id } FulfillmentItemViewModel.new( order_item, quantity: fulfillment_item.quantity_canceled ) end.compact end end end end
Version data entries
34 entries across 34 versions & 1 rubygems