mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
We changed to tracking stock of on-demand items to be able to place backorders. This is mostly hidden in the app but was still visible on the inventory page. Now we are hiding that here, too.
25 lines
538 B
Ruby
25 lines
538 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
module Admin
|
|
class VariantOverrideSerializer < ActiveModel::Serializer
|
|
attributes :id, :hub_id, :variant_id, :sku, :price, :count_on_hand, :on_demand,
|
|
:default_stock, :resettable, :tag_list, :tags, :import_date
|
|
|
|
def count_on_hand
|
|
return if object.on_demand
|
|
|
|
object.count_on_hand
|
|
end
|
|
|
|
def tag_list
|
|
object.tag_list.join(",")
|
|
end
|
|
|
|
def tags
|
|
object.tag_list.map { |t| { text: t } }
|
|
end
|
|
end
|
|
end
|
|
end
|