app/services/distribution_itemized_breakdown_service.rb
#
# Returns a hash containing the itemized breakdown of
# what was distributed.
#
# @return [Array]
Returns a hash containing the itemized breakdown of
what was distributed.
Returns a hash containing the itemized breakdown of what was distributed .
def fetch
    items_distributed = fetch_items_distributed
    items_distributed.map! do |item|
      item_name = item[:name]
      item.merge({
        current_onhand: current_onhand_quantities[item_name],
        onhand_minimum: current_onhand_minimums[item_name],
        below_onhand_minimum: current_onhand_quantities[item_name] < current_onhand_minimums[item_name]
      })
    end
    items_distributed.sort_by { |item| -item[:distributed] }
  end
def fetch items_distributed = fetch_items_distributed items_distributed . map! do | item | item_name = item [ :name ] item . merge ( { current_onhand : current_onhand_quantities [ item_name ] , onhand_minimum : current_onhand_minimums [ item_name ] , below_onhand_minimum : current_onhand_quantities [ item_name ] < current_onhand_minimums [ item_name ] } ) end items_distributed . sort_by { | item | - item [ :distributed ] } end
Returns a hash containing the itemized breakdown of
what was distributed.
Returns a hash containing the itemized breakdown of what was distributed .
# Inject the "onhand" data
None
Array