Skip to content

Commit ac86c0c

Browse files
committed
fix: announce results count when filtering errors on report
1 parent 2389c43 commit ac86c0c

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

confiture-web-app/src/components/AuditGenerationCriterium.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const result = reactive<CriteriumResult>({
5555
)!,
5656
});
5757
58-
/*
58+
/*
5959
the result status can be updated from an external source (the not applicable
6060
page switch and the autofill debug button)
6161
So we watch the store to make sure to update our local state if needed.

confiture-web-app/src/components/ReportErrors.vue

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,45 @@ const disabledResetFilters = computed(
8080
const minorUserImpactErrorCount = computed(
8181
() =>
8282
report.data?.results.filter(
83-
(r) => r.userImpact === CriterionResultUserImpact.MINOR
83+
(r) =>
84+
r.status === CriteriumResultStatus.NOT_COMPLIANT &&
85+
r.userImpact === CriterionResultUserImpact.MINOR
8486
).length
8587
);
8688
8789
const majorUserImpactErrorCount = computed(
8890
() =>
8991
report.data?.results.filter(
90-
(r) => r.userImpact === CriterionResultUserImpact.MAJOR
92+
(r) =>
93+
r.status === CriteriumResultStatus.NOT_COMPLIANT &&
94+
r.userImpact === CriterionResultUserImpact.MAJOR
9195
).length
9296
);
9397
9498
const blockingUserImpactErrorCount = computed(
9599
() =>
96100
report.data?.results.filter(
97-
(r) => r.userImpact === CriterionResultUserImpact.BLOCKING
101+
(r) =>
102+
r.status === CriteriumResultStatus.NOT_COMPLIANT &&
103+
r.userImpact === CriterionResultUserImpact.BLOCKING
98104
).length
99105
);
100106
101107
const unknownUserImpactErrorCount = computed(
102-
() => report.data?.results.filter((r) => r.userImpact === null).length
108+
() =>
109+
report.data?.results.filter(
110+
(r) =>
111+
r.status === CriteriumResultStatus.NOT_COMPLIANT &&
112+
r.userImpact === null
113+
).length
103114
);
104115
116+
const displayedErrorCount = computed(() => {
117+
return errors.value
118+
.map((page) => page.topics.map((topic) => topic.errors))
119+
.flat(2).length;
120+
});
121+
105122
function expandAll() {
106123
const collapses = Array.from(
107124
document.querySelectorAll("[data-accordion] > [data-fr-js-collapse]")
@@ -343,9 +360,11 @@ function updateActiveAnchorLink(id: string, event: MouseEvent) {
343360

344361
<div>
345362
<div class="fr-mb-6w header">
346-
<span class="fr-mb-0 fr-text--xl fr-text--bold"
347-
>{{ report.data.errorCount }} résultats</span
348-
>
363+
<div role="alert" aria-live="polite">
364+
<p class="fr-mb-0 fr-text--xl fr-text--bold">
365+
{{ displayedErrorCount }} résultats
366+
</p>
367+
</div>
349368
<button class="fr-btn fr-btn--tertiary-no-outline" @click="expandAll">
350369
Tout déplier
351370
</button>

0 commit comments

Comments
 (0)