]> git.0d.be Git - django-panik-emissions.git/commitdiff
limit schedule sort on date object
authorFrédéric Péters <fpeters@0d.be>
Mon, 27 Apr 2020 11:14:53 +0000 (13:14 +0200)
committerFrédéric Péters <fpeters@0d.be>
Mon, 27 Apr 2020 11:14:53 +0000 (13:14 +0200)
emissions/models.py

index 8dade8c5e6c9d38660b2adc85656cf0af79fea22..cf4f5c492ed0155cf16dd2beb566e19a3cafe488 100644 (file)
@@ -195,7 +195,7 @@ class Emission(models.Model):
         possible_dates = []
         for schedule in schedules:
             possible_dates.append((schedule.get_next_planned_date(since), schedule))
-        possible_dates.sort()
+        possible_dates.sort(key=lambda x: x[0])
         return possible_dates[0]
 
     def get_next_planned_date(self, since=None):