Sha256: eb3f7a1e44889810f912c0083d3b019ea375feafbb84e2bcaa39eb6466ad31f8

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

module Workarea
  decorate Storefront::UserActivityViewModel, with: :flow_io do
    # TODO base bug, product isn't passing options into product view models
    def products
      @products ||=
        begin
          product_ids = model.product_ids.uniq.first(display_count)
          models = Catalog::Product.any_in(_id: product_ids).to_a
          models = models.select(&:active?)

          product_ids.map do |id|
            product = models.detect { |p| p.id == id }
            Storefront::ProductViewModel.wrap(product, options) if product
          end.compact
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 app/view_models/workarea/storefront/user_activity_view_model.decorator