Class: Account::DiscountsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- Account::DiscountsController
- Defined in:
- app/controllers/account/discounts_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
caches_page_with_cache_marker, #raise_not_found!
Instance Method Details
#index ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/account/discounts_controller.rb', line 7 def index # @discounts = current_account.discounts # @ticket = TranslationCms::Api::Ticket # .all(_satellite_id: Settings.satellite_id) # .reject{|t| t.picture_url.blank? }.first case @group when DiscountsPageType.onetime @coupons = TranslationCms::Api::Customers::Discounts::Coupon.all @personal_coupons = TranslationCms::Api::Customers::Discounts::PersonalCoupon.all when DiscountsPageType.lifetime @lifetimes = TranslationCms::Api::Discounts::Lifetime.all!.sort { |x, y| x.value <=> y.value } customer_lifetimes = TranslationCms::Api::Customers::Discounts::Lifetime.all @active_lifetime = customer_lifetimes.map(&:value).max || 0 @customer_lifetime = customer_lifetimes.detect { |l| l.value == @active_lifetime } end end |