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

Correct expand/collapse logic for month view in my time tracking

Klaus Zanders2aaaf20ee799
diff --git a/modules/costs/app/components/my/time_tracking/list_component.rb b/modules/costs/app/components/my/time_tracking/list_component.rb
index 8560f46cf37..4ea3c954fb9 100644
--- a/modules/costs/app/components/my/time_tracking/list_component.rb
+++ b/modules/costs/app/components/my/time_tracking/list_component.rb
@@ -98,13 +98,15 @@ module My
end
end
- def collapsed?(date)
+ def collapsed?(date) # rubocop:disable Metrics/AbcSize
return false if mode == :day
+ return false if mode.in?(%i[week workweek]) && range.exclude?(Date.current)
+ return false if mode == :month && range.exclude?(Date.current.beginning_of_week)
- if range.include?(Date.current)
- !date.today?
+ if mode == :month
+ Date.current.cweek != date.cweek
else
- false
+ !date.today?
end
end