From a97c8a60b23a889bd82f2857a622bd1a1a631685 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 --- scripts/fetchData.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/fetchData.js b/scripts/fetchData.js index 8c54013..a4218a7 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.ENV_NODE == "production") { + 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";