114554395-start_date_added

This commit is contained in:
Stas 2016-03-21 20:15:36 +02:00
parent 59ed022d8d
commit ffb76c7372
5 changed files with 34 additions and 5 deletions

View file

@ -1,8 +1,8 @@
class Admin::AccountActivitiesController < AdminController
load_and_authorize_resource
before_action :set_default_dates, only: [:index]
def index # rubocop: disable Metrics/AbcSize
params[:q] ||= {}
ca_cache = params[:q][:created_at_lteq]
begin
@ -41,4 +41,13 @@ class Admin::AccountActivitiesController < AdminController
params[:q][:created_at_lteq] = ca_cache
end
def set_default_dates
params[:q] ||= {}
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil?
params[:q][:created_at_gteq] = Time.now.strftime("%Y-%m-%d")
end
end
end