Skip to content

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

exclude ongoing timers from my time tracking page

Klaus Zanders5f7870ba8c98
diff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rb
index 659f501ac12..1532352dea8 100644
--- a/modules/costs/app/controllers/my/time_tracking_controller.rb
+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb
@@ -125,7 +125,7 @@ module My
@time_entries = TimeEntry
.includes(:project, :activity, { work_package: :status })
.where(project_id: Project.visible.select(:id))
- .where(user: User.current, spent_on: time_scope)
+ .where(user: User.current, spent_on: time_scope, ongoing: false)
.order(:spent_on, :start_time, :hours)
end
diff --git a/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb b/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb
index 78473e5f92e..f7853da4420 100644
--- a/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb
+++ b/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb
@@ -97,6 +97,16 @@ RSpec.describe My::TimeTrackingController do
end
end
end
+
+ context "with an ongoing timer" do
+ let!(:time_entry) { create(:time_entry, user: user, spent_on: Date.current, hours: 1.5) }
+ let!(:time_entry_ongoing) { create(:time_entry, user: user, spent_on: Date.current, ongoing: true) }
+
+ it "does not include the ongoing timer in the my time tracking page (Regression: #64173)" do
+ get :index
+ expect(assigns(:time_entries)).to contain_exactly(time_entry)
+ end
+ end
end
describe "GET /my/time-tracking/day" do