Ajout possibilité de configurer le champ permettant de créer la liste des derniers quizs

This commit is contained in:
Fabrice PENHOËT 2020-09-07 18:38:13 +02:00
parent 71b71a2520
commit df0bacf181
3 changed files with 3 additions and 2 deletions

View File

@ -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,

View File

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