total_1ère

This commit is contained in:
2026-07-20 16:33:04 +02:00
parent dd49ba357b
commit d49cf88d99
275 changed files with 63607 additions and 5599 deletions

View File

@@ -1,7 +1,8 @@
function profil(adherent_type) {
let profil1, profil2, profil3 ;
console.log ("function profil.adherent_type: ", adherent_type)
console.log ("function profil.adherent_type: ", adherent_type);
adherent_type = (adherent_type || "").trim().toLowerCase();
if (adherent_type === "famille") {
profil1 = "Famille";
console.log("profil1 : ", profil1);
@@ -22,29 +23,30 @@ function profil(adherent_type) {
}
if (adherent_type === "prof_stagiaire") {
profil1 = "Professeur";
profil2 = "Professeur stagiaire";
profil2 = "Stagiaire ESA";
console.log("profil1 : ", profil1);
console.log("profil2 : ", profil2);
}
if (adherent_type === "prof_stagiaire_famille") {
profil1 = "Professeur";
profil2 = "Professeur stagiaire";
profil2 = "Stagiaire ESA";
profil3 = "Élève";
console.log("profil1 : ", profil1);
console.log("profil2 : ", profil2);
console.log("profil3 : ", profil3);
}
if (adherent_type === "prof_stagiaire1") {
profil1 = "Professeur stagiaire";
profil1 = "Stagiaire ESA";
console.log("profil1 : ", profil1);
}
if (adherent_type === "prof_stagiaire1_famille") {
profil1 = "Professeur stagiaire";
profil1 = "Stagiaire ESA";
profil2 = "Élève";
console.log("profil1 : ", profil1);
console.log("profil2 : ", profil2);
}
console.log("RETURN profil1 : ", profil1);
//return profil1;
return [profil1, profil2, profil3];

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////
// LOGGING
/////////////////////////////////////////////////
const logger = require("../../public/js/app/logger_adhesion");
const cron = require('node-cron');
const axios = require('axios');
////////////////////////////////////////////////////
// FILE NAME
////////////////////////////////////////////////////
const path = require("path");
const filename = path.parse(__filename).base;
// URL de la page à lancer pour faire la mise à jour
const URL = "https://inscription.afpedagogiesuzuki.fr/adhesion/sync_prof_strapi";
// Fonction pour envoyer la requête POST
const maj_annuaire = async () => {
try {
const response = await axios.get(URL);
logger.info("annuaire maj avec succès: " + response.status, { numsession:"maj_annuaire", label: filename});
} catch (error) {
logger.error("Erreur lors de la maj de l'annuaire: " + error, { numsession:"maj_annuaire", label: filename});
}
};
// Définir la tâche cron : ici, elle s'exécute toutes les 2 minutes
// cron.schedule('*/2 * * * *', () => {
// Définir la tâche cron : ici, elle s'exécute à 4h du matin
// cron.schedule('0 4 * * *', () => {
cron.schedule('0 4 * * *', () => {
logger.info("MAJ annuaire cron lancée (modules/adhesion/maj_annuaire_prof_site_auto.js)", { numsession:"maj_annuaire", label: filename});
maj_annuaire();
});

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////
// LOGGING
/////////////////////////////////////////////////
const logger = require("../../public/js/app/logger_adhesion");
const path = require("path");
const cron = require('node-cron');
const axios = require('axios');
////////////////////////////////////////////////////
// FILE NAME
////////////////////////////////////////////////////
const filename = path.parse(__filename).base;
// URL du webhook
//const WEBHOOK_URL = "http://localhost:8890/adhesion/maj_googlesheet_auto";
const WEBHOOK_URL = "https://inscription.afpedagogiesuzuki.fr/adhesion/maj_googlesheet_auto";
//const WEBHOOK_URL = process.env.adhesion_maj_gs_webhook_url; //cela ne fonctionne pas
// Fonction pour envoyer la requête POST
const envoyerWebhook = async () => {
try {
const response = await axios.get(WEBHOOK_URL, {});
logger.info("Webhook envoyé avec succès: " + response.status, { numsession:"webhook", label: filename});
} catch (error) {
logger.error("Erreur lors de l'envoi du webhook: " + error.message, { numsession:"webhook", label: filename});
}
};
// Définir la tâche cron : ici, elle s'exécute toutes les 2 minutes
// cron.schedule('*/2 * * * *', () => {
// Définir la tâche cron : ici, elle s'exécute à 3h du matin
// cron.schedule('0 3 * * *', () => {
cron.schedule('0 3 * * *', () => {
logger.info("Envoi du webhook (modules/adhesion/majgs_webhook.js) à l'heure prévue", { numsession:"webhook", label: filename});
envoyerWebhook();
});