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