diff --git a/confiture-rest-api/src/audits/audit.service.ts b/confiture-rest-api/src/audits/audit.service.ts index 0326d09f..01ca2351 100644 --- a/confiture-rest-api/src/audits/audit.service.ts +++ b/confiture-rest-api/src/audits/audit.service.ts @@ -820,17 +820,23 @@ export class AuditService { ); const notApplicableCriteria = Object.values(groupedCriteria).filter( - (criteria) => - criteria.every((c) => c.status === CriterionResultStatus.NOT_APPLICABLE) + (criteria) => { + return criteria + .filter((c) => c.pageId !== audit.transverseElementsPageId) + .every((c) => c.status === CriterionResultStatus.NOT_APPLICABLE); + } ); - const compliantCriteria = applicableCriteria.filter((criteria) => - criteria.every( - (c) => - c.status === CriterionResultStatus.COMPLIANT || - c.status === CriterionResultStatus.NOT_APPLICABLE - ) - ); + const compliantCriteria = applicableCriteria.filter((criteria) => { + // Exclude criteria from transverse elements page. + return criteria + .filter((c) => c.pageId !== audit.transverseElementsPageId) + .every( + (c) => + c.status === CriterionResultStatus.COMPLIANT || + c.status === CriterionResultStatus.NOT_APPLICABLE + ); + }); const notCompliantCriteria = applicableCriteria.filter((criteria) => criteria.some((c) => c.status === CriterionResultStatus.NOT_COMPLIANT) diff --git a/confiture-web-app/src/composables/useAuditStats.ts b/confiture-web-app/src/composables/useAuditStats.ts index d030c873..d1c87ad6 100644 --- a/confiture-web-app/src/composables/useAuditStats.ts +++ b/confiture-web-app/src/composables/useAuditStats.ts @@ -1,6 +1,6 @@ import { computed } from "vue"; -import { useResultsStore } from "../store"; +import { useAuditStore, useResultsStore } from "../store"; import { CriterionResultUserImpact, CriteriumResult, @@ -8,6 +8,7 @@ import { } from "../types"; export function useAuditStats() { + const auditStore = useAuditStore(); const store = useResultsStore(); const groupedCriteria = computed(() => { @@ -33,15 +34,20 @@ export function useAuditStats() { const notApplicableCriteriaCount = computed(() => { return Object.values(groupedCriteria.value).filter((criteria) => { return criteria - .slice(1) + .filter( + (c) => c.pageId !== auditStore.currentAudit?.transverseElementsPage.id + ) .every((c) => c.status === CriteriumResultStatus.NOT_APPLICABLE); }).length; }); const compliantCriteriaCount = computed(() => { return applicableCriteria.value.filter((criteria) => { + // Exclude criteria from transverse elements page. return criteria - .slice(1) + .filter( + (c) => c.pageId !== auditStore.currentAudit?.transverseElementsPage.id + ) .every( (c) => c.status === CriteriumResultStatus.COMPLIANT || @@ -72,13 +78,17 @@ export function useAuditStats() { criteria.some((c) => c.status !== CriteriumResultStatus.NOT_APPLICABLE) ); - const compliantCriteria = applicableCriteria.filter((criteria) => - criteria.every( - (c) => - c.status === CriteriumResultStatus.COMPLIANT || - c.status === CriteriumResultStatus.NOT_APPLICABLE - ) - ); + const compliantCriteria = applicableCriteria.filter((criteria) => { + return criteria + .filter( + (c) => c.pageId !== auditStore.currentAudit?.transverseElementsPage.id + ) + .every( + (c) => + c.status === CriteriumResultStatus.COMPLIANT || + c.status === CriteriumResultStatus.NOT_APPLICABLE + ); + }); return ( Math.round(