From f7f56095a01c178f6ca2b0dcfcf546a836038729 Mon Sep 17 00:00:00 2001 From: Quentin Bellanger Date: Fri, 22 Nov 2024 11:01:59 +0100 Subject: [PATCH] =?UTF-8?q?Assure=20que=20les=20pages=20sont=20ordonn?= =?UTF-8?q?=C3=A9es=20avant=20de=20changer=20d'onglets=20(#877)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * make sure pages are ordered when changing pages tabs * create a computed for ordered pages * sort audit pages in store * update changelog --- CHANGELOG.md | 1 + .../src/pages/audit/AuditGenerationPage.vue | 16 +++++++--------- confiture-web-app/src/store/audit.ts | 14 +++++++++++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53ae9957..a97addcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Tous les changements notables de Ara sont documentés ici avec leur date, leur c ### Corrections 🐛 +- Corrige le problème des filtres des critères qui décalait l’ordre des pages de l’échantillon sur la page d’audit ([#877](https://github.com/DISIC/Ara/pull/877)) - Corrige la "fausse" mise à jour des paramètres de l’audit quand on quitte la page sans sauvegarder ([#875](https://github.com/DISIC/Ara/pull/875)) ## 21/11/2024 diff --git a/confiture-web-app/src/pages/audit/AuditGenerationPage.vue b/confiture-web-app/src/pages/audit/AuditGenerationPage.vue index e3c5660c..96084b69 100644 --- a/confiture-web-app/src/pages/audit/AuditGenerationPage.vue +++ b/confiture-web-app/src/pages/audit/AuditGenerationPage.vue @@ -1,5 +1,4 @@ diff --git a/confiture-web-app/src/store/audit.ts b/confiture-web-app/src/store/audit.ts index 4db3a3a3..976d1517 100644 --- a/confiture-web-app/src/store/audit.ts +++ b/confiture-web-app/src/store/audit.ts @@ -1,4 +1,5 @@ import ky from "ky"; +import { sortBy } from "lodash-es"; import { defineStore } from "pinia"; import { @@ -60,13 +61,20 @@ export const useAuditStore = defineStore("audit", { return response; }, + setAudit(id: string, audit: Audit) { + this.entities[id] = { + ...audit, + pages: sortBy(audit.pages, "order") + }; + }, + async fetchAudit(editUniqueId: string) { this.currentAuditId = editUniqueId; const data = (await ky .get(`/api/audits/${editUniqueId}`) .json()) as Audit; - this.entities[editUniqueId] = data; + this.setAudit(editUniqueId, data); }, async fetchAuditIfNeeded(editUniqueId: string) { @@ -86,7 +94,7 @@ export const useAuditStore = defineStore("audit", { json: data }) .json()) as Audit; - this.entities[uniqueId] = response; + this.setAudit(uniqueId, response); return response; }, @@ -163,7 +171,7 @@ export const useAuditStore = defineStore("audit", { const response = (await ky .put(`/api/audits/${uniqueId}/publish`) .json()) as Audit; - this.entities[uniqueId] = response; + this.setAudit(uniqueId, response); return response; },