Skip to content

Commit

Permalink
Ajoute un onglet "éléments transverses" (#758)
Browse files Browse the repository at this point in the history
* remove ability to set a criterium as transverse

* add new tab for transverse elements

* show transverse notice

* add transverse status in notice

* always show 3 criterium statuses

* handle transverse page when creating and saving settings

* display transverse criteria in report errors tab

* display transverse criteria in report improvements tab

* simplify data functions to get errors & improvements

* rename transverse tab

* redesign transverse status indicator

* display transverse comment

* update wording and remove optional mentions

* remove first audit page and table wrappers in context and report pages

* clean transverse data filtering

* add transverse callout in results detail tab

* add icon to transverse tab

* fix ts types

* fix ts error on dynamic component

* TEMP

* return transverse page data in audit endpoints

* include transverse results in fetch

* fix spacing + get id of transverse page

* take transverse page into account in report

* lint backend

* adjust transverse comment margin

* hide topic NA on transverse page

* update wording on transverse criterium

* exclude transverse results from audit progression

* fix already evaluated filter

* exclude transverse results in topics completion

* set currentPageId to transverse page by default

* exclude transverse results to display in progress banner

* exclude transverse results to display in progress banner 2

* fix page title when on transverse tab

* exclude transverse criteria to calculate not applicable and compliant criteria

* include transverse elements in exports

* fix audit stats computing

* harmonize wording

* criterium is nc if c on all pages but nc on transverse elements

* update wording on transverse result notice

* update computing applicable & compliant criteria

* harmonize nc and c gauges on both audit and report

* compute audit stats from scratch

* fix na criteria count

* include transverse criteria in account audits list

* migration to add transverse page to audits

* fix migration syntax

* clean report errors and improvements sorting

* change default transverse page order, fix report menu

* add na on all page toggle on transverse elements page

* update criterium comment accordion wording

* add transverse elements alert on audit pages

* harmonize wording on report

* fix improvements sorting on report

* Update confiture-web-app/src/pages/report/ContextPage.vue

Co-authored-by: Adrien Boutigny <[email protected]>

* refactor switch statement

* update changelog

---------

Co-authored-by: Adrien Boutigny <[email protected]>
  • Loading branch information
bellangerq and hissalht authored Oct 17, 2024
1 parent bb8a169 commit bd7e0c9
Show file tree
Hide file tree
Showing 30 changed files with 799 additions and 506 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Tous les changements notables de Ara sont documentés ici avec leur date, leur catégorie (nouvelle fonctionnalité, correction de bug ou autre changement) et leur pull request (PR) associée.

## 17/10/2024

### Nouvelles fonctionnalités 🚀

- Modifie la gestion des éléments transverses : l’interrupteur "Sur toutes les pages" est remplacé par l’onglet "Éléments transverses" qui permet d’évaluer les éléments communs à toutes les pages : en-tête, pied de page... ([#758](https://github.com/DISIC/Ara/pull/758))

## 09/10/2024

### Corrections 🐛
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- AlterTable
ALTER TABLE "Audit" ADD COLUMN "transverseElementsPageId" INTEGER;

-- Create one transverse elements page for each existing audit and link it
DO $$
DECLARE temprow RECORD;
DECLARE transversePageId "AuditedPage"."id"%TYPE;
BEGIN FOR temprow IN
SELECT * FROM "Audit" WHERE "transverseElementsPageId" IS NULL
LOOP
-- Crée la page élément transverse
INSERT INTO "AuditedPage"("name", "url", "order") VALUES ('Éléments transverses (optionnel)', '', -1) RETURNING "id" INTO transversePageId;
-- Lie la page à l'audit
UPDATE "Audit" SET "transverseElementsPageId" = transversePageId WHERE "id" = "temprow"."id";
END LOOP;
END $$;

-- Make transverseElementsPageId not nullable
ALTER TABLE "Audit" ALTER COLUMN "transverseElementsPageId" SET NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX "Audit_transverseElementsPageId_key" ON "Audit"("transverseElementsPageId");

-- AddForeignKey
ALTER TABLE "Audit" ADD CONSTRAINT "Audit_transverseElementsPageId_fkey" FOREIGN KEY ("transverseElementsPageId") REFERENCES "AuditedPage"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
12 changes: 10 additions & 2 deletions confiture-rest-api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ model Audit {
auditType AuditType
procedureName String
/// @DtoEntityHidden
pages AuditedPage[]
pages AuditedPage[] @relation("UserPages")
// single page for transverse elements
transverseElementsPage AuditedPage @relation("TransversePage", fields: [transverseElementsPageId], references: [id])
transverseElementsPageId Int @unique
auditorName String?
auditorEmail String?
showAuditorEmailInReport Boolean @default(false)
Expand Down Expand Up @@ -111,9 +114,14 @@ model AuditedPage {
name String
url String
audit Audit? @relation(fields: [auditUniqueId], references: [editUniqueId], onDelete: Cascade)
// parent audit when the page is a user made page
audit Audit? @relation(name: "UserPages", fields: [auditUniqueId], references: [editUniqueId], onDelete: Cascade)
auditUniqueId String?
// parent audit when the page is a transverse page
auditTransverse Audit? @relation(name: "TransversePage")
results CriterionResult[]
}

Expand Down
15 changes: 13 additions & 2 deletions confiture-rest-api/src/audits/audit-export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export class AuditExportService {
const data = [];

// Column headers
data.push(["Critères", ...audit.pages.map((p) => p.name)]);
data.push([
"Critères",
"Éléments transverses",
...audit.pages.map((p) => p.name)
]);

const resultsByCriteria = groupBy(
results,
Expand All @@ -50,14 +54,21 @@ export class AuditExportService {
// Tests results
criteria.forEach((c) => {
const criterionKey = c.topic + "." + c.criterium;

const transverseStatus =
CRITERIUM_STATUS[
resultsByCriteria[criterionKey].find(
(r) => r.pageId === audit.transverseElementsPageId
).status
];
const criteriumStatuses = audit.pages.map(
(p) =>
CRITERIUM_STATUS[
resultsByCriteria[criterionKey].find((r) => r.pageId === p.id)
.status
]
);
data.push([criterionKey, ...criteriumStatuses]);
data.push([criterionKey, transverseStatus, ...criteriumStatuses]);
});

// compile data to CSV buffer
Expand Down
Loading

0 comments on commit bd7e0c9

Please sign in to comment.