From 47662ea545287094a828ad6603b91dfb386f8e6d Mon Sep 17 00:00:00 2001 From: Manus Date: Sun, 18 Jan 2026 09:17:21 -0500 Subject: [PATCH] =?UTF-8?q?Checkpoint:=20Augmentation=20de=20la=20tol?= =?UTF-8?q?=C3=A9rance=20du=20scheduler=20de=20rappels=20de=2020=20=C3=A0?= =?UTF-8?q?=2030=20minutes=20pour=20couvrir=202=20cycles=20de=20v=C3=A9rif?= =?UTF-8?q?ication=20(intervalle=20de=2015=20minutes).=20Cela=20permet=20d?= =?UTF-8?q?e=20capturer=20les=20rappels=20m=C3=AAme=20si=20le=20serveur=20?= =?UTF-8?q?a=20red=C3=A9marr=C3=A9=20ou=20si=20le=20scheduler=20a=20manqu?= =?UTF-8?q?=C3=A9=20un=20cycle.=20Par=20exemple,=20un=20rappel=20configur?= =?UTF-8?q?=C3=A9=20=C3=A0=2015h03=20sera=20maintenant=20envoy=C3=A9=20m?= =?UTF-8?q?=C3=AAme=20si=20le=20scheduler=20v=C3=A9rifie=20=C3=A0=2015h15?= =?UTF-8?q?=20ou=2015h30.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .manus/db/db-query-1768745709790.json | 18 +++++++++ .manus/db/db-query-1768745715203.json | 9 +++++ .manus/db/db-query-1768745719444.json | 58 +++++++++++++++++++++++++++ server/rappelScheduler.ts | 4 +- todo.md | 2 + 5 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 .manus/db/db-query-1768745709790.json create mode 100644 .manus/db/db-query-1768745715203.json create mode 100644 .manus/db/db-query-1768745719444.json 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