Sha256: f6490112ddd60f9b466b9c934eb7d2cbec8d785791682f7b4c97caf4c0c8f63e

Contents?: true

Size: 584 Bytes

Versions: 24

Compression:

Stored size: 584 Bytes

Contents

module Workarea
  module Admin
    class CodeListViewModel < ApplicationViewModel
      def promo_codes
        @promo_codes ||= model.promo_codes.page(options[:page])
      end

      def unused_promo_codes
        @unused_promo_codes ||= model.promo_codes.unused.to_a
      end

      def used_count
        model.promo_codes.count - unused_promo_codes.count
      end

      def last_used_at
        @last_used_at ||= model.promo_codes.order(used_at: :desc).first.used_at
      end

      def timeline
        @timeline ||= TimelineViewModel.new(model)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.26 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.45 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.25 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.23 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.44 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.22 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.43 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.21 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.42 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.20 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.41 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.19 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.40 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.18 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.39 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.17 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.38 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.5.16 app/view_models/workarea/admin/code_list_view_model.rb
workarea-admin-3.4.37 app/view_models/workarea/admin/code_list_view_model.rb