OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
DRY out controller
Klaus Zanders776d354161d6
diff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rbindex 1ceed938efd..c6f5e00ac4b 100644--- a/modules/costs/app/controllers/my/time_tracking_controller.rb+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb@@ -51,9 +51,7 @@ module Myhelper_method :current_day, :today?, :this_week?, :this_month?, :time_entries_jsondef day- @time_entries = TimeEntry- .includes(:project, :activity, :work_package)- .where(user: User.current, spent_on: current_day)+ load_time_entries(current_day)# TODO: At some point the filters will reduce the list, so we need to load them seperately@project_filters = @time_entries.map(&:project).uniq@@ -61,9 +59,7 @@ module Myenddef week- @time_entries = TimeEntry- .includes(:project, :activity, :work_package)- .where(user: User.current, spent_on: current_day.all_week)+ load_time_entries(current_day.all_week)# TODO: At some point the filters will reduce the list, so we need to load them seperately@project_filters = @time_entries.map(&:project).uniq@@ -71,9 +67,7 @@ module Myenddef month- @time_entries = TimeEntry- .includes(:project, :activity, :work_package)- .where(user: User.current, spent_on: current_day.all_month)+ load_time_entries(current_day.all_month)# TODO: At some point the filters will reduce the list, so we need to load them seperately@project_filters = @time_entries.map(&:project).uniq@@ -127,5 +121,11 @@ module Mywhen :month then Time.zone.today.beginning_of_monthendend++ def load_time_entries(time_scope)+ @time_entries = TimeEntry+ .includes(:project, :activity, { work_package: :status })+ .where(user: User.current, spent_on: time_scope)+ endendend