feat: filtre les scores en production
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Simon 2023-10-19 16:27:48 +02:00
parent 2960b936b1
commit 336bfbfc6d
3 changed files with 8 additions and 1 deletions

View File

@ -50,6 +50,8 @@ steps:
- npm run fetchData - npm run fetchData
- npm run lint - npm run lint
- npm run build - npm run build
environment:
NODE_ENV: 'production'
- name: deploy on s3 - name: deploy on s3
image: minio/mc image: minio/mc

View File

@ -10,5 +10,6 @@ module.exports = {
], ],
env: { env: {
"vue/setup-compiler-macros": true, "vue/setup-compiler-macros": true,
node: true,
}, },
}; };

View File

@ -47,7 +47,11 @@ async function fetchScoresData() {
const url = `/items/scores?${fields const url = `/items/scores?${fields
.map((item) => `fields[]=${item}`) .map((item) => `fields[]=${item}`)
.join("&")}`; .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"); await fs.writeFile("./src/data.json", JSON.stringify(scores), "utf8");
const folder = "public/answers"; const folder = "public/answers";