From 7a61fc49079acb5bd94198a82b306c79b489a863 Mon Sep 17 00:00:00 2001 From: Simon C Date: Thu, 19 Oct 2023 16:27:48 +0200 Subject: [PATCH] feat: filtre les scores en production --- .eslintrc.cjs | 1 + scripts/fetchData.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ed2ab70..bd4d9f4 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -10,5 +10,6 @@ module.exports = { ], env: { "vue/setup-compiler-macros": true, + node: true, }, }; diff --git a/scripts/fetchData.js b/scripts/fetchData.js index 8c54013..361b88c 100644 --- a/scripts/fetchData.js +++ b/scripts/fetchData.js @@ -47,7 +47,11 @@ async function fetchScoresData() { const url = `/items/scores?${fields .map((item) => `fields[]=${item}`) .join("&")}`; - const scores = (await fetchJSONApi(url)).data; + let scores = (await fetchJSONApi(url)).data; + if (process.env.NODE_ENV != "staging") { + console.log("Suppresion des scores avec le mode brouillon en production"); + scores = scores.filter((score) => !score.draft); + } await fs.writeFile("./src/data.json", JSON.stringify(scores), "utf8"); const folder = "public/answers";