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);