From a79aa6db60aba39b2648f01553116d6ffcdca34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Wed, 19 Oct 2016 00:01:10 +0200 Subject: [PATCH] =?UTF-8?q?program:=20show=20days=20in=20order=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- planning/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/planning/utils.py b/planning/utils.py index 4c8fe60..af1a8a3 100644 --- a/planning/utils.py +++ b/planning/utils.py @@ -88,7 +88,7 @@ class Program: def _body(self): output = '' - for day in self.days.keys(): + for day in sorted(self.days.keys()): output += self._day_header(day) output += self._day(day) return output @@ -142,7 +142,6 @@ class Program: start = ts end = self.days[day]['timeslots'][self.days[day]['timeslots'].index(ts)+1] duration = (end - start).seconds / 60 - print(start, end, duration) date_to_string = lambda date: datetime.strftime(localtime(date), '%H:%M') style = 'height: %dpx;' % int(duration * 1.2) timeslot = '%s – %s' % tuple(map(date_to_string, [start, end]))