Sha256: 604d2cce4387e633970b697f7e2d008554e092c24033b685240e6221f51fc889

Contents?: true

Size: 432 Bytes

Versions: 28

Compression:

Stored size: 432 Bytes

Contents

module Workarea
  module Admin
    module Reports
      class LowInventoryViewModel < ApplicationViewModel
        def results
          @results ||= model.results.map do |result|
            OpenStruct.new({ sku: skus[result['_id']] }.merge(result))
          end
        end

        def skus
          @skus ||= Inventory::Sku.any_in(id: model.results.map { |r| r['_id'] }).to_lookup_hash
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.6 app/view_models/workarea/admin/reports/low_inventory_view_model.rb
workarea-admin-3.5.5 app/view_models/workarea/admin/reports/low_inventory_view_model.rb
workarea-admin-3.5.4 app/view_models/workarea/admin/reports/low_inventory_view_model.rb
workarea-admin-3.5.3 app/view_models/workarea/admin/reports/low_inventory_view_model.rb
workarea-admin-3.5.2 app/view_models/workarea/admin/reports/low_inventory_view_model.rb
workarea-admin-3.5.1 app/view_models/workarea/admin/reports/low_inventory_view_model.rb
workarea-admin-3.5.0 app/view_models/workarea/admin/reports/low_inventory_view_model.rb
workarea-admin-3.5.0.beta.1 app/view_models/workarea/admin/reports/low_inventory_view_model.rb