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
switch order to avoid CTE being included unnecessarily in subselects
Jens Ulferts785693f790ac
diff --git a/app/models/work_packages/scopes/include_spent_time.rb b/app/models/work_packages/scopes/include_spent_time.rbindex 50ae482b8ec..ac0cfe3ced1 100644--- a/app/models/work_packages/scopes/include_spent_time.rb+++ b/app/models/work_packages/scopes/include_spent_time.rb@@ -31,8 +31,8 @@ module WorkPackages::Scopes::IncludeSpentTimeclass_methods dodef include_spent_time(user, work_package = nil)- scope = with(visible_time_entries_cte.name => allowed_to_view_time_entries(user))- .left_join_self_and_descendants(user, work_package)+ scope = left_join_self_and_descendants(user, work_package)+ .with(visible_time_entries_cte.name => allowed_to_view_time_entries(user)).joins(join_visible_time_entries.join_sources).group(:id).select("SUM(#{visible_time_entries_cte.name}.hours) AS hours")