diff --git a/src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.component.ts b/src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.component.ts index 4e7bf4f6bc..0b10131ed6 100644 --- a/src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.component.ts +++ b/src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.component.ts @@ -136,11 +136,16 @@ export class EntityCountDashboardComponent this.label = this._entity.labelPlural; this.entityIcon = this._entity.icon; + // Load all entities of the specified type const entities = await this.entityMapper.loadType(this._entity); - this.totalEntities = entities.length; + + // Filter entities to only include active ones for the total count + const activeEntities = entities.filter((e) => e.isActive); + + this.totalEntities = activeEntities.length; for (const groupByField of this.groupBy) { this.entityGroupCounts[groupByField] = this.calculateGroupCounts( - entities.filter((e) => e.isActive), + activeEntities, groupByField, ); } diff --git a/src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.stories.ts b/src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.stories.ts index 92ec77b99b..94679a5642 100644 --- a/src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.stories.ts +++ b/src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.stories.ts @@ -39,6 +39,6 @@ const Template: StoryFn = ( export const Primary = { args: { entityType: "TestEntity", - groupBy: ["other"], + groupBy: ["category", "other"], }, };