Skip to content

Commit

Permalink
sort returned pages sample by order and remove transverse
Browse files Browse the repository at this point in the history
  • Loading branch information
bellangerq committed Oct 23, 2024
1 parent 12fe8d0 commit 1027aab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 6 additions & 1 deletion confiture-web-app/src/pages/StatementPage.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { sortBy } from "lodash-es";
import { computed, ref } from "vue";
import { useRoute } from "vue-router";
Expand Down Expand Up @@ -104,6 +105,10 @@ const siteUrl = computed(() => {
return null;
});
const pages = computed(() => {
return sortBy(report.data?.context.samples.slice(1), (p) => p.order);
});
</script>

<template>
Expand Down Expand Up @@ -327,7 +332,7 @@ const siteUrl = computed(() => {
Pages du site ayant fait l’objet de la vérification de conformité
</h5>
<ul class="fr-mb-9v fr-mb-md-6w">
<li v-for="page in report.data.context.samples" :key="page.name">
<li v-for="page in pages" :key="page.name">
{{ page.name }} <strong class="page-url">{{ page.url }}</strong>
</li>
</ul>
Expand Down
13 changes: 8 additions & 5 deletions confiture-web-app/src/pages/report/ContextPage.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { sortBy } from "lodash-es";
import { computed } from "vue";
import { useRoute } from "vue-router";
import PageMeta from "../../components/PageMeta";
Expand All @@ -21,6 +23,10 @@ useWrappedFetch(() => report.fetchReport(uniqueId));
* - auditor email (API)
* - derogated content
*/
const pages = computed(() => {
return sortBy(report.data?.context.samples.slice(1), (p) => p.order);
});
</script>

<template>
Expand Down Expand Up @@ -139,7 +145,7 @@ useWrappedFetch(() => report.fetchReport(uniqueId));

<p>
L’audit a porté sur un échantillon de
<strong>{{ report.data.context.samples.length - 1 }} pages</strong> :
<strong>{{ pages.length }} pages</strong> :
</p>

<div class="fr-table fr-table--no-caption">
Expand All @@ -158,10 +164,7 @@ useWrappedFetch(() => report.fetchReport(uniqueId));
</tr>
</thead>
<tbody>
<tr
v-for="(page, i) in report.data.context.samples.slice(1)"
:key="i"
>
<tr v-for="(page, i) in pages" :key="i">
<td>{{ i + 1 }}</td>
<td>{{ page.name }}</td>
<td>
Expand Down

0 comments on commit 1027aab

Please sign in to comment.