Class: ClientLogin::ReportsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/client_login/reports_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
# File 'app/controllers/client_login/reports_controller.rb', line 3

def index
end

#work_unitsObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/client_login/reports_controller.rb', line 6

def work_units
  params[:start_date_hidden] ||= Date.current.beginning_of_month.to_s
  params[:end_date_hidden] ||= Date.current.end_of_month.to_s
  start_date = Time.zone.parse(params[:start_date_hidden]).beginning_of_day
  end_date = Time.zone.parse(params[:end_date_hidden]).end_of_day
  if params[:project_id].nil?
    project = Project.for_user(current_user).first
  else
    project = Project.for_user(current_user).find params[:project_id]
  end
  @work_units = WorkUnit.order("scheduled_at desc").for_project(project).scheduled_between(start_date,end_date)
end