From ee35260d970cd4b090929f6fdad00add191c3f2f Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Sun, 31 Mar 2024 21:43:55 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20du=20d=C3=A9lai=20d'un=20mois?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rooms_get.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/rooms_get.py b/rooms_get.py index 0cb8b33..df83beb 100644 --- a/rooms_get.py +++ b/rooms_get.py @@ -22,6 +22,7 @@ import pytz import os import shutil import time +import datetime # Fichiers locaux : from objects import Room @@ -248,14 +249,9 @@ def get_tot_rooms(datet, depts, ignore_list) : # sur une période de 'margintime' mois : cals = list() # Liste des EDT des départements choisis for d in depts : - if datet.month < 12 : - result = sched_get(datet, d.link, - datet.replace(month = datet.month + margintime), - NO_CACHE) - else : - result = sched_get(datet, d.link, - datet.replace(month = 1, year = datet.year + 1), - NO_CACHE) + result = sched_get(datet, d.link, + datet + datetime.timedelta(margintime), + NO_CACHE) # # Utilisation du module 'ics' pour le tri du calendrier dans l'ordre # # chronologique : # cal = ics.Calendar(result) @@ -416,4 +412,4 @@ def getrooms(datet, depts, ignore_list) : dept_index += 1 - return total_rooms \ No newline at end of file + return total_rooms