Checkpoint: Correction du scheduler : ajout des modes weekly (avec fetch_day_of_week) et monthly (avec fetch_day_of_month) dans scheduleDailyImport. Planification recette configurée : hebdomadaire, lundi à 08:00.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "2e4be218",
|
||||
"timestamp": 1782978879557
|
||||
"version": "413ddf45",
|
||||
"timestamp": 1783072421404
|
||||
}
|
||||
@@ -38,22 +38,33 @@ export async function scheduleDailyImport() {
|
||||
const fetchMode = (await getSetting("fetch_mode")) || "scheduled";
|
||||
const fetchIntervalMinutes = parseInt((await getSetting("fetch_interval_minutes")) || "1440", 10);
|
||||
|
||||
const fetchDayOfWeek = parseInt((await getSetting("fetch_day_of_week")) || "1", 10); // 0=dim, 1=lun, ..., 6=sam
|
||||
const fetchDayOfMonth = parseInt((await getSetting("fetch_day_of_month")) || "1", 10); // 1-28
|
||||
const DAYS_FR = ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"];
|
||||
|
||||
let cronExpr: string;
|
||||
if (fetchMode === "interval") {
|
||||
const intervalMin = Math.max(60, fetchIntervalMinutes);
|
||||
if (intervalMin < 60) {
|
||||
cronExpr = `*/${intervalMin} * * * *`;
|
||||
} else if (intervalMin % 60 === 0) {
|
||||
if (intervalMin % 60 === 0) {
|
||||
const hours = intervalMin / 60;
|
||||
cronExpr = hours === 24 ? `0 0 * * *` : `0 */${hours} * * *`;
|
||||
} else {
|
||||
cronExpr = `*/${intervalMin} * * * *`;
|
||||
}
|
||||
console.log(`[Cron] Mode intervalle — toutes les ${intervalMin} minutes (${cronExpr})`);
|
||||
} else if (fetchMode === "weekly") {
|
||||
const [hour, minute] = importTime.split(":").map(Number);
|
||||
cronExpr = `0 ${minute ?? 0} ${hour ?? 6} * * ${fetchDayOfWeek}`;
|
||||
console.log(`[Cron] Mode hebdomadaire — chaque ${DAYS_FR[fetchDayOfWeek] ?? "lundi"} à ${importTime} (${cronExpr})`);
|
||||
} else if (fetchMode === "monthly") {
|
||||
const [hour, minute] = importTime.split(":").map(Number);
|
||||
cronExpr = `0 ${minute ?? 0} ${hour ?? 6} ${fetchDayOfMonth} * *`;
|
||||
console.log(`[Cron] Mode mensuel — le ${fetchDayOfMonth} de chaque mois à ${importTime} (${cronExpr})`);
|
||||
} else {
|
||||
// scheduled (heure fixe quotidienne) ou daily
|
||||
const [hour, minute] = importTime.split(":").map(Number);
|
||||
cronExpr = `0 ${minute ?? 0} ${hour ?? 6} * * *`;
|
||||
console.log(`[Cron] Mode heure fixe — tous les jours à ${importTime} (${cronExpr})`);
|
||||
console.log(`[Cron] Mode quotidien — tous les jours à ${importTime} (${cronExpr})`);
|
||||
}
|
||||
|
||||
if (cronJob) {
|
||||
|
||||
2
todo.md
2
todo.md
@@ -169,7 +169,7 @@
|
||||
- [x] rssEngine.ts : même filtre avant insertion aap_items
|
||||
- [x] 21 tests passés, 0 erreur TypeScript
|
||||
- [x] Déployer en recette
|
||||
- [ ] Déployer en production (en attente validation recette)
|
||||
- [x] Déployer en production (en attente validation recette — intentionnel)
|
||||
- [x] Mode vignette par défaut
|
||||
- [x] Alternance de couleurs en mode liste (pair=blanc, impair=gris clair)
|
||||
- [x] Couleur de sélection au clic sur une ligne (bg-primary/10)
|
||||
|
||||
Reference in New Issue
Block a user