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
Fix counting on multiple columns for project
Oliver Günther9ec1e058914d
diff --git a/lib/api/decorators/offset_paginated_collection.rb b/lib/api/decorators/offset_paginated_collection.rbindex b5f58fc7b9c..ead34ed1cf4 100644--- a/lib/api/decorators/offset_paginated_collection.rb+++ b/lib/api/decorators/offset_paginated_collection.rb@@ -46,7 +46,7 @@ module APIfull_self_link = make_page_link(page: @page, page_size: @per_page)paged = paged_models(models)- super(paged, models.count, self_link: full_self_link, current_user: current_user, groups: groups)+ super(paged, total_count(models), self_link: full_self_link, current_user: current_user, groups: groups)endlink :jumpTo do@@ -87,6 +87,12 @@ module APIexec_context: :decorator,getter: ->(*) { @page }+ protected++ def total_count(models)+ models.count(:id)+ end+privatedef make_page_link(page:, page_size:)diff --git a/modules/dashboards/spec/features/subprojects_spec.rb b/modules/dashboards/spec/features/subprojects_spec.rbindex 4cddfecee22..315a59cd920 100644--- a/modules/dashboards/spec/features/subprojects_spec.rb+++ b/modules/dashboards/spec/features/subprojects_spec.rb@@ -82,6 +82,9 @@ describe 'Subprojects widget on dashboard', type: :feature, js: true dosubprojects_widget = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(1)')+ expect(page)+ .to have_link(child_project.name, wait: 10)+within(subprojects_widget.area) doexpect(page).to have_link(child_project.name)diff --git a/spec/lib/api/v3/groups/group_collection_representer_spec.rb b/spec/lib/api/v3/groups/group_collection_representer_spec.rbindex eb2e2a138a0..56bf6e22000 100644--- a/spec/lib/api/v3/groups/group_collection_representer_spec.rb+++ b/spec/lib/api/v3/groups/group_collection_representer_spec.rb@@ -41,6 +41,10 @@ describe ::API::V3::Groups::GroupCollectionRepresenter do.to receive(:page).with(page).and_return(groups)++ allow(groups)+ .to receive(:count)+ .and_return(total)endendlet(:current_user) { FactoryBot.build_stubbed(:user) }diff --git a/spec/lib/api/v3/memberships/membership_collection_representer_spec.rb b/spec/lib/api/v3/memberships/membership_collection_representer_spec.rbindex beca6a1d185..c686144d211 100644--- a/spec/lib/api/v3/memberships/membership_collection_representer_spec.rb+++ b/spec/lib/api/v3/memberships/membership_collection_representer_spec.rb@@ -41,6 +41,10 @@ describe ::API::V3::Memberships::MembershipCollectionRepresenter do.to receive(:page).with(page).and_return(members)++ allow(members)+ .to receive(:count)+ .and_return(3)endendlet(:current_user) { FactoryBot.build_stubbed(:user) }diff --git a/spec/lib/api/v3/notifications/notification_collection_representer_spec.rb b/spec/lib/api/v3/notifications/notification_collection_representer_spec.rbindex c051cb5c6bf..744e54e5573 100644--- a/spec/lib/api/v3/notifications/notification_collection_representer_spec.rb+++ b/spec/lib/api/v3/notifications/notification_collection_representer_spec.rb@@ -43,6 +43,10 @@ describe ::API::V3::Notifications::NotificationCollectionRepresenter do.to receive(:page).with(page).and_return(items)++ allow(items)+ .to receive(:count)+ .and_return(total)endendlet(:current_user) { FactoryBot.build_stubbed(:user) }diff --git a/spec/lib/api/v3/placeholder_users/placeholder_user_collection_representer_spec.rb b/spec/lib/api/v3/placeholder_users/placeholder_user_collection_representer_spec.rbindex 5eff556a927..da1127de072 100644--- a/spec/lib/api/v3/placeholder_users/placeholder_user_collection_representer_spec.rb+++ b/spec/lib/api/v3/placeholder_users/placeholder_user_collection_representer_spec.rb@@ -50,6 +50,10 @@ describe ::API::V3::PlaceholderUsers::PlaceholderUserCollectionRepresenter do.with(page).and_return(placeholders)+ allow(placeholders)+ .to receive(:count)+ .and_return(total)+placeholdersenddiff --git a/spec/lib/api/v3/users/paginated_user_collection_representer_spec.rb b/spec/lib/api/v3/users/paginated_user_collection_representer_spec.rbindex fd477f128af..8d3997a8085 100644--- a/spec/lib/api/v3/users/paginated_user_collection_representer_spec.rb+++ b/spec/lib/api/v3/users/paginated_user_collection_representer_spec.rb@@ -49,6 +49,10 @@ describe ::API::V3::Users::PaginatedUserCollectionRepresenter do.with(page).and_return(users)+ allow(users)+ .to receive(:count)+ .and_return(total)+usersend