From fcec2e9698021aebb2cf2d2424fc3b7d64e3ca6c Mon Sep 17 00:00:00 2001 From: Ananda Date: Thu, 28 Nov 2024 14:48:33 +0100 Subject: [PATCH] style: review style du widget (#298) --- server/src/cli.js | 8 +++- .../src/jobs/stats/computeContinuumStats.js | 4 +- .../jobs/stats/importFormationsSupStats.js | 1 + .../assets/remixicon.light.symbol.svg | 5 +++ .../widget/templates/common/header.ejs | 13 +++++- .../widget/templates/stats/default.1.ejs | 41 +++++++++++++++++-- .../widget/templates/stats/personas.1.ejs | 12 ++++-- .../stats/importFormationsSupStats-test.js | 1 + 8 files changed, 73 insertions(+), 12 deletions(-) diff --git a/server/src/cli.js b/server/src/cli.js index 14d613b2..afabc37d 100644 --- a/server/src/cli.js +++ b/server/src/cli.js @@ -118,8 +118,12 @@ cli .command("computeContinuumStats") .description("Calcule les données statistiques manquantes pour les anciens/nouveaux diplomes") .argument("[stats]", "Le nom des stats à importer (formations,certifications,regionales)", asArray) - .action((stats) => { - runScript(() => computeContinuumStats({ stats })); + .option( + "--millesime [millesime]", + "Spécifie un millésime à importer (attention les millésimes nationales et formations/regionales sont différents" + ) + .action((stats, options) => { + runScript(() => computeContinuumStats({ stats, millesime: options.millesime })); }); cli diff --git a/server/src/jobs/stats/computeContinuumStats.js b/server/src/jobs/stats/computeContinuumStats.js index dd5e1124..99592adc 100644 --- a/server/src/jobs/stats/computeContinuumStats.js +++ b/server/src/jobs/stats/computeContinuumStats.js @@ -203,6 +203,8 @@ export async function computeContinuumStats(options = {}) { let stats = options.stats || ["certifications", "regionales", "formations"]; const result = { total: 0, created: 0, updated: 0, failed: 0 }; + const millesime = options.millesime || null; + function handleError(e, context = {}) { logger.error({ err: e, ...context }, `Impossible de calculer les données pour les anciens/nouveaux diplomes`); result.failed++; @@ -211,7 +213,7 @@ export async function computeContinuumStats(options = {}) { await oleoduc( mergeStreams(stats.map(streamStats)), - filterData(({ data }) => data.donnee_source.type === "self"), + filterData(({ data }) => data.donnee_source.type === "self" && (!millesime || data.millesime === millesime)), transformData(async ({ data, statName }) => { const query = { ...getQueryForStats({ data, statName, millesime: data.millesime }) }; diff --git a/server/src/jobs/stats/importFormationsSupStats.js b/server/src/jobs/stats/importFormationsSupStats.js index e471b68a..58b4362f 100644 --- a/server/src/jobs/stats/importFormationsSupStats.js +++ b/server/src/jobs/stats/importFormationsSupStats.js @@ -106,6 +106,7 @@ export async function importFormationsSupStats(options = {}) { code_certification: formationStats.diplome, type: "self", }, + libelle_etablissement: formationStats.uo_lib, "_meta.insersup": { etablissement_libelle: formationStats.uo_lib, etablissement_actuel_libelle: formationStats.uo_lib_actuel, diff --git a/server/src/services/widget/templates/assets/remixicon.light.symbol.svg b/server/src/services/widget/templates/assets/remixicon.light.symbol.svg index 496f5221..689e6709 100644 --- a/server/src/services/widget/templates/assets/remixicon.light.symbol.svg +++ b/server/src/services/widget/templates/assets/remixicon.light.symbol.svg @@ -34,4 +34,9 @@ d="M12 0.585693L18 6.58569V9H22V19H23V21H1V19H2V9H6V6.58569L12 0.585693ZM18 19H20V11H18V19ZM6 11H4V19H6V11ZM8 7.41412V18.9999H11V12H13V18.9999H16V7.41412L12 3.41412L8 7.41412Z"> + + + + \ No newline at end of file diff --git a/server/src/services/widget/templates/common/header.ejs b/server/src/services/widget/templates/common/header.ejs index aa96de22..ffcec040 100644 --- a/server/src/services/widget/templates/common/header.ejs +++ b/server/src/services/widget/templates/common/header.ejs @@ -149,7 +149,7 @@ .card { margin-top: 10px; padding: 10px; - margin-bottom: 15px; + margin-bottom: 2rem; } .card-footer { @@ -171,6 +171,12 @@ margin-right: 0; } + .external-small[target=_blank]:after { + --icon-size: 0.75rem; + height: var(--icon-size); + width: var(--icon-size); + } + @media screen and (min-width: <%=options.responsiveWidth %>) {} @@ -188,5 +194,10 @@ .card-footer { text-align: left; } + + .card { + padding-left: 0px; + padding-right: 0px; + } } \ No newline at end of file diff --git a/server/src/services/widget/templates/stats/default.1.ejs b/server/src/services/widget/templates/stats/default.1.ejs index 0609c653..97440118 100644 --- a/server/src/services/widget/templates/stats/default.1.ejs +++ b/server/src/services/widget/templates/stats/default.1.ejs @@ -106,6 +106,13 @@ vertical-align: text-top; } + + .block-title .description { + font-size: 18px; + font-weight: 700; + line-height: 28px; + } + .body-description { margin-bottom: 10px; } @@ -274,7 +281,7 @@ @media screen and (max-width: <%=options.responsiveWidth %>) { :root { - --body-width: min(calc(var(--widget-width) * 0.8 / <%=maxEleves %>), 30px); + --body-width: 50px; --body-height: calc(var(--body-width) * 1.8125); --body-icon-width: calc(var(--body-width) * 0.4); @@ -282,6 +289,12 @@ --body-icon-top: calc(var(--body-width) * 0.5); } + + .body-group { + flex-wrap: wrap; + justify-content: normal; + } + .bodies { display: flex; align-items: flex-start; @@ -289,7 +302,7 @@ flex-direction: column; gap: 2px; margin-bottom: 10px; - margin-left: 10px; + margin-left: 0px; ; } @@ -314,7 +327,27 @@ @media screen and (max-width: 30em) { .block-title { - font-size: 12px; + font-size: 16px; + } + + .block-title .description { + font-size: 20px; + } + + .block-title .icon { + width: 22px; + height: 22px; + } + } + + @media screen and (max-width: 19em) { + :root { + --body-width: 45px; + --body-height: calc(var(--body-width) * 1.8125); + + --body-icon-width: calc(var(--body-width) * 0.4); + --body-icon-left: calc(var(--body-width) * 0.29); + --body-icon-top: calc(var(--body-width) * 0.5); } } @@ -427,7 +460,7 @@ <% } %> diff --git a/server/src/services/widget/templates/stats/personas.1.ejs b/server/src/services/widget/templates/stats/personas.1.ejs index 7f141198..f273c88d 100644 --- a/server/src/services/widget/templates/stats/personas.1.ejs +++ b/server/src/services/widget/templates/stats/personas.1.ejs @@ -28,8 +28,10 @@ @@ -42,11 +44,13 @@ <% if (taux[key].value > 0) { %> diff --git a/server/tests/jobs/stats/importFormationsSupStats-test.js b/server/tests/jobs/stats/importFormationsSupStats-test.js index 0d80e974..37f16aff 100644 --- a/server/tests/jobs/stats/importFormationsSupStats-test.js +++ b/server/tests/jobs/stats/importFormationsSupStats-test.js @@ -55,6 +55,7 @@ describe("importFormationsSupStats", () => { code_certification: "2500200", code_certification_type: "sise", libelle: "METIERS DE L'ENSEIGNEMENT", + libelle_etablissement: "Université Côte d'Azur", millesime: "2020_2021", filiere: "superieur", date_fermeture: new Date("2023-01-01T00:00:00.000Z"),