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
Mark correct today date for the my time tracking page
Klaus Zandersb34319aeb17e
diff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rbindex da455856fa3..028ba832e54 100644--- a/modules/costs/app/controllers/my/time_tracking_controller.rb+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb@@ -118,11 +118,7 @@ module Myenddef current_date- case mode- when :day then Time.zone.today- when :week, :workweek then Time.zone.today.beginning_of_week(week_start_day)- when :month then Time.zone.today.beginning_of_month- end+ Time.zone.todayenddef load_time_entries(time_scope)diff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rbindex 99067fe8b73..a6a56ad0c1d 100644--- a/modules/costs/lib/costs/engine.rb+++ b/modules/costs/lib/costs/engine.rb@@ -144,7 +144,7 @@ module Costsmenu :global_menu,:my_time_tracking,- { controller: "/my/time_tracking", action: "index" },+ { controller: "/my/time_tracking", action: "index", date: "today" },after: :my_page,caption: :label_my_time_tracking,if: ->(*) dodiff --git a/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb b/modules/costs/spec/controllers/my/time_tracking_controller_spec.rbindex 78473e5f92e..243f3fad367 100644--- a/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb+++ b/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb@@ -117,9 +117,9 @@ RSpec.describe My::TimeTrackingController doenddescribe "GET /my/time-tracking/week" do- it "without a date param it uses the beginning of current week" do+ it "without a date param it uses the current day" doget :index, params: { mode: :week }- expect(assigns(:date)).to eq(Date.current.beginning_of_week)+ expect(assigns(:date)).to eq(Date.current)endit "with a date param it uses the given date" do@@ -127,16 +127,16 @@ RSpec.describe My::TimeTrackingController doexpect(assigns(:date)).to eq(Date.parse("2023-12-31"))end- it "with an invalid date param it uses the beginning of current week" do+ it "with an invalid date param it uses the current day" doget :index, params: { mode: :week, date: "invalid-date" }- expect(assigns(:date)).to eq(Date.current.beginning_of_week)+ expect(assigns(:date)).to eq(Date.current)endenddescribe "GET /my/time-tracking/month" do- it "without a date param it uses the beginning of current month" do+ it "without a date param it uses the current day" doget :index, params: { mode: :month }- expect(assigns(:date)).to eq(Date.current.beginning_of_month)+ expect(assigns(:date)).to eq(Date.current)endit "with a date param it uses the given date" do@@ -144,9 +144,9 @@ RSpec.describe My::TimeTrackingController doexpect(assigns(:date)).to eq(Date.parse("2023-12-31"))end- it "with an invalid date param it uses the beginning of current month" do+ it "with an invalid date param it uses the current day" doget :index, params: { mode: :month, date: "invalid-date" }- expect(assigns(:date)).to eq(Date.current.beginning_of_month)+ expect(assigns(:date)).to eq(Date.current)endendend