diff --git a/.manus/db/db-query-1768745709790.json b/.manus/db/db-query-1768745709790.json new file mode 100644 index 0000000..4483fdf --- /dev/null +++ b/.manus/db/db-query-1768745709790.json @@ -0,0 +1,18 @@ +{ + "query": "SELECT id, nom, timing, joursAvant, heureEnvoi, actif FROM rappels WHERE nom = 'J+2' OR timing = 'J+2';", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute SELECT id, nom, timing, joursAvant, heureEnvoi, actif FROM rappels WHERE nom = 'J+2' OR timing = 'J+2';", + "rows": [ + { + "id": "30001", + "nom": "J+2", + "timing": "post_formation", + "joursAvant": "2", + "heureEnvoi": "09:00", + "actif": "1" + } + ], + "messages": [], + "stdout": "id\tnom\ttiming\tjoursAvant\theureEnvoi\tactif\n30001\tJ+2\tpost_formation\t2\t09:00\t1\n", + "stderr": "", + "execution_time_ms": 233 +} \ No newline at end of file diff --git a/.manus/db/db-query-1768745715203.json b/.manus/db/db-query-1768745715203.json new file mode 100644 index 0000000..184117d --- /dev/null +++ b/.manus/db/db-query-1768745715203.json @@ -0,0 +1,9 @@ +{ + "query": "SELECT * FROM rappels WHERE id = 9;", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute SELECT * FROM rappels WHERE id = 9;", + "rows": [], + "messages": [], + "stdout": "", + "stderr": "", + "execution_time_ms": 141 +} \ No newline at end of file diff --git a/.manus/db/db-query-1768745719444.json b/.manus/db/db-query-1768745719444.json new file mode 100644 index 0000000..ccaeacb --- /dev/null +++ b/.manus/db/db-query-1768745719444.json @@ -0,0 +1,58 @@ +{ + "query": "SELECT id, nom, timing, joursAvant, heureEnvoi, actif FROM rappels WHERE actif = 1;", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute SELECT id, nom, timing, joursAvant, heureEnvoi, actif FROM rappels WHERE actif = 1;", + "rows": [ + { + "id": "1", + "nom": "J-7", + "timing": "pre_formation", + "joursAvant": "7", + "heureEnvoi": "09:00", + "actif": "1" + }, + { + "id": "2", + "nom": "J-15", + "timing": "pre_formation", + "joursAvant": "15", + "heureEnvoi": "09:00", + "actif": "1" + }, + { + "id": "30001", + "nom": "J+2", + "timing": "post_formation", + "joursAvant": "2", + "heureEnvoi": "09:00", + "actif": "1" + }, + { + "id": "60001", + "nom": "J-3", + "timing": "pre_formation", + "joursAvant": "3", + "heureEnvoi": "09:00", + "actif": "1" + }, + { + "id": "60002", + "nom": "J+30", + "timing": "post_formation", + "joursAvant": "30", + "heureEnvoi": "09:00", + "actif": "1" + }, + { + "id": "90001", + "nom": "J+10", + "timing": "post_formation", + "joursAvant": "10", + "heureEnvoi": "09:00", + "actif": "1" + } + ], + "messages": [], + "stdout": "id\tnom\ttiming\tjoursAvant\theureEnvoi\tactif\n1\tJ-7\tpre_formation\t7\t09:00\t1\n2\tJ-15\tpre_formation\t15\t09:00\t1\n30001\tJ+2\tpost_formation\t2\t09:00\t1\n60001\tJ-3\tpre_formation\t3\t09:00\t1\n60002\tJ+30\tpost_formation\t30\t09:00\t1\n90001\tJ+10\tpost_formation\t10\t09:00\t1\n", + "stderr": "", + "execution_time_ms": 49 +} \ No newline at end of file diff --git a/server/rappelScheduler.ts b/server/rappelScheduler.ts index 563a07b..1b19934 100644 --- a/server/rappelScheduler.ts +++ b/server/rappelScheduler.ts @@ -53,9 +53,9 @@ async function processRappel(rappel: any) { // Parser l'heure configurée (format "HH:MM") const [heureRappel, minuteRappel] = (rappel.heureEnvoi || "09:00").split(":").map(Number); - // Vérifier si on est dans la bonne heure (avec une tolérance de 20 minutes) + // Vérifier si on est dans la bonne heure (avec une tolérance de 30 minutes pour couvrir 2 cycles de vérification) const diffMinutes = Math.abs((heureActuelle * 60 + minuteActuelle) - (heureRappel * 60 + minuteRappel)); - if (diffMinutes > 20) { + if (diffMinutes > 30) { console.log(`[Rappels] Heure actuelle ${heureActuelle}:${minuteActuelle.toString().padStart(2, '0')} ne correspond pas à l'heure configurée ${rappel.heureEnvoi} (différence: ${diffMinutes} minutes) - rappel ignoré`); return; } diff --git a/todo.md b/todo.md index b5514e3..9e84516 100644 --- a/todo.md +++ b/todo.md @@ -867,3 +867,5 @@ - [x] Corriger le problème d'envoi automatique des rappels qui ne se déclenchent pas à l'heure programmée (ajout vérification heure + intervalle 15 min au lieu de 1h) - [x] Ajouter un bouton "Tout renvoyer" pour envoyer en masse toutes les attestations chargées manuellement sur une séquence - [x] Corriger le scheduler de rappels qui ne trouve aucune date de formation (utilisation table rappelDates + correction heureEnvoi) +- [x] Augmenter la tolérance du scheduler de rappels de 20 à 30 minutes pour couvrir 2 cycles de vérification +- [ ] Vérifier l'heure configurée en base de données pour le rappel J+2