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

Correctly collapse the sums together with the group header

Oliver Günther9d327900b988
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts
index 3b22355e3d1..89097406e88 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts
@@ -6,6 +6,7 @@ import {SchemaResource} from "core-app/modules/hal/resources/schema-resource";
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {SchemaCacheService} from "core-components/schemas/schema-cache.service";
import {DisplayFieldService} from "core-app/modules/fields/display/display-field.service";
+import {groupedRowClassName} from "core-components/wp-fast-table/builders/modes/grouped/grouped-rows-helpers";
export class GroupSumsBuilder extends SingleRowBuilder {
@@ -19,7 +20,7 @@ export class GroupSumsBuilder extends SingleRowBuilder {
public buildSumsRow(group:GroupObject) {
const tr:HTMLTableRowElement = document.createElement('tr');
- tr.classList.add('wp-table--sums-row', 'wp-table--row');
+ tr.classList.add('wp-table--sums-row', 'wp-table--row', groupedRowClassName(group.index));
this.renderColumns(group.sums, tr);
diff --git a/spec/features/work_packages/index_sums_spec.rb b/spec/features/work_packages/index_sums_spec.rb
index b074ff7ab64..9902d721ed7 100644
--- a/spec/features/work_packages/index_sums_spec.rb
+++ b/spec/features/work_packages/index_sums_spec.rb
@@ -128,5 +128,14 @@ RSpec.feature 'Work package index sums', js: true do
expect(page).to have_selector('tfoot .wp-table--sum-container', text: '35')
expect(page).to have_selector("tfoot .wp-table--sum-container.customField#{int_cf.id}", text: '12')
expect(page).to have_selector("tfoot .wp-table--sum-container.customField#{float_cf.id}", text: '13.2')
+
+ # Collapsing groups will also hide the sums row
+ page.find('.expander.icon-minus2', match: :first).click
+ sleep 1
+ page.find('.expander.icon-minus2', match: :first).click
+
+ # Expect to have only the final sums
+ expect(page).to have_selector('tbody .wp-table--sums-row', count: 0)
+ expect(page).to have_selector('tfoot .wp-table--sums-row', count: 1)
end
end