Test + debug contrôleurs des groupes appelés via cronjobs.
This commit is contained in:
parent
87869b87f3
commit
6a9a006a9d
@ -224,12 +224,13 @@ exports.HTMLRegenerate= async (req, res, next) =>
|
||||
// CRONS
|
||||
|
||||
// Supprime fichiers json de groupes n'existant plus.
|
||||
exports.deleteJsonFiles = async (req, res, next) =>
|
||||
exports.cronDeleteJsonFiles = async (req, res, next) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const db = require("../models/index");
|
||||
const groups=await db["Group"].findAll({ attributes: ["id"] });
|
||||
let saveFiles=["stats.json"];// dans le même répertoire et à garder.
|
||||
for(let i in groups)
|
||||
saveFiles.push(groups[i].id+".json");
|
||||
const deleteFiles = await toolFile.deleteFilesInDirectory(configQuestionnaires.dirCacheGroups, saveFiles);
|
||||
@ -243,7 +244,7 @@ exports.deleteJsonFiles = async (req, res, next) =>
|
||||
}
|
||||
|
||||
// Teste si des groupes doivent être publiés
|
||||
exports.checkGroupsNeedToBePublished = async (req, res, next) =>
|
||||
exports.cronCheckGroupsNeedToBePublished = async (req, res, next) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -385,9 +386,9 @@ const checkGroupsNeedToBePublished = async (regenerate=false) =>
|
||||
{
|
||||
if(regenerate === false)
|
||||
{
|
||||
if(await toolFile.checkIfFileExist(configQuestionnaires.dirHTMLGroups, group.Group.slug+".html") === false)
|
||||
if(toolFile.checkIfFileExist(configQuestionnaires.dirHTMLGroups, groups[i].slug+".html") === false)
|
||||
{
|
||||
const publishedOk=await creaGroupHTML(groups[i].id);// creaGroupHTLM contrôle que le groupe est publiable.
|
||||
const publishedOk = await creaGroupHTML(groups[i].id);// creaGroupHTLM contrôle que le groupe est publiable.
|
||||
if(publishedOk)
|
||||
nb++;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ exports.deleteJsonFiles= async (req, res, next) =>
|
||||
{
|
||||
const db = require("../models/index");
|
||||
const questionnaires=await db["Questionnaire"].findAll({ attributes: ["id"] });
|
||||
let saveFiles=["last.json","stats.json"];// dans le même répertoir et à garder.
|
||||
let saveFiles=["last.json","stats.json"];// dans le même répertoire et à garder.
|
||||
for(let i in questionnaires)
|
||||
saveFiles.push(questionnaires[i].id+".json");
|
||||
const deleteFiles = await toolFile.deleteFilesInDirectory(configQuestionnaires.dirCacheQuestionnaires, saveFiles);
|
||||
|
@ -30,8 +30,8 @@ router.get("/deletequestionnairesfiles/:token", cronAuth, ctrlQuestionnaire.dele
|
||||
router.get("/deletequestionsfiles/:token", cronAuth, ctrlQuestion.deleteJsonFiles);
|
||||
router.get("/publishquestionnaires/:token", cronAuth, ctrlQuestionnaire.checkQuestionnairesNeedToBePublished);
|
||||
// + Groupes
|
||||
router.get("/deletegroupsfiles/:token", cronAuth, ctrlGroup.deleteJsonFiles);
|
||||
router.get("/publishgroups/:token", cronAuth, ctrlGroup.checkGroupsNeedToBePublished);
|
||||
router.get("/deletegroupsfiles/:token", cronAuth, ctrlGroup.cronDeleteJsonFiles);
|
||||
router.get("/publishgroups/:token", cronAuth, ctrlGroup.cronCheckGroupsNeedToBePublished);
|
||||
|
||||
// Illustrations des questionnaires
|
||||
router.get("/deleteoldillustrations/:token", cronAuth, ctrlIllustration.deleteOldFiles);
|
||||
|
Loading…
Reference in New Issue
Block a user