From df0bacf18152a523187243996ed75db1bef30231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20PENHO=C3=8BT?= Date: Mon, 7 Sep 2020 18:38:13 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20possibilit=C3=A9=20de=20configurer=20le?= =?UTF-8?q?=20champ=20permettant=20de=20cr=C3=A9er=20la=20liste=20des=20de?= =?UTF-8?q?rniers=20quizs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/instance-example.js | 1 + config/questionnaires.js | 2 +- controllers/questionnaire.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/instance-example.js b/config/instance-example.js index 5441785..bb98e0a 100644 --- a/config/instance-example.js +++ b/config/instance-example.js @@ -39,6 +39,7 @@ module.exports = hourGiveNewQuestionnaireEnd: 8, // idem numberNewQuestionnaireAtSameTime: 50, // for mass mailing sending new quiz minSearchQuestionnaires: 3, + fieldNewQuestionnaires : "publishingAt", // field to be used to create the list of the last questionnaires, can be "createdAt", "updatedAt" or "publishingAt" // Illustrations: nbIllustrationsMin: 0, nbIllustrationsMax: 1, diff --git a/config/questionnaires.js b/config/questionnaires.js index 59efa48..34c8a26 100644 --- a/config/questionnaires.js +++ b/config/questionnaires.js @@ -37,7 +37,7 @@ module.exports = Choice : { text: { maxlength: 255, required: true } - }, + }, nbQuestionsMin: 1, nbQuestionsMax: 0, nbChoicesMax: 10, diff --git a/controllers/questionnaire.js b/controllers/questionnaire.js index 4405b01..251021f 100644 --- a/controllers/questionnaire.js +++ b/controllers/questionnaire.js @@ -586,7 +586,7 @@ const checkQuestionnairesPublishedHaveHTML = async (regenerate=false) => const creaNewQuestionnairesJson = async () => { const db = require("../models/index"); - const Questionnaires=await db["Questionnaire"].findAll({ where: { isPublished : true }, order: [["updatedAt", "DESC"], ["id", "DESC"]], attributes: ["id"], limit: config.nbNewQuestionnaires }); + const Questionnaires=await db["Questionnaire"].findAll({ where: { isPublished : true }, order: [[config.fieldNewQuestionnaires, "DESC"], ["id", "DESC"]], attributes: ["id"], limit: config.nbNewQuestionnaires }); if(Questionnaires) { await toolFile.createJSON(config.dirCacheQuestionnaires, "last", Questionnaires);