Class: DashboardController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DashboardController
- Defined in:
- app/controllers/dashboard_controller.rb
Constant Summary
Constants included from Localization
Localization::LOCALIZED_STRINGS
Instance Method Summary collapse
Methods inherited from ApplicationController
in_place_edit_for, #initialize
Methods included from ApplicationHelper
#back_or_link_to, #detour?, #detour_to, #display_notice, #h, #image_button_to, #image_detour_to, #image_link_to, #image_link_to_remote, #insert, #record, #resolution_image, #t, #update_task, #with_detour
Methods included from Localization
#l, load_localized_strings, #valid_language?
Constructor Details
This class inherits a constructor from ApplicationController
Instance Method Details
#show ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/dashboard_controller.rb', line 2 def show date = Date.today year = date.year week = date.cweek last_week = 1.week.ago.to_date.cweek last_year = week == 1 ? year - 1 : year month = Date.today.month last_month = month == 1 ? 12 : month - 1 last_months_year = month == 1 ? year - 1 : year @week_day = Date.today.wday @users = [] for user in current_user.work_lock_subscriptions @users<<[user, Work.work_sum_per_week(last_year, last_week, user), Work.work_sum_per_week(year, week, user), Work.work_sum_per_day(date, user), Work.work_sum_per_month(year, month, user), Work.work_sum_per_month(last_months_year, last_month, user), Work.invoice_work_sum_per_week(last_year, last_week, user), Work.invoice_work_sum_per_week(year, week, user), Work.invoice_work_sum_per_day(date, user), Work.invoice_work_sum_per_month(year, month, user), Work.invoice_work_sum_per_month(last_months_year, last_month, user)] end end |