]> git.0d.be Git - panikweb.git/commitdiff
Revert "grid: handle new "sonar" case"
authorFrédéric Péters <fpeters@0d.be>
Wed, 2 Dec 2015 13:16:30 +0000 (14:16 +0100)
committerFrédéric Péters <fpeters@0d.be>
Wed, 2 Dec 2015 13:16:30 +0000 (14:16 +0100)
This reverts commit 35b0e73766273094b82a3ece36efb63283d79260, this is worse
than before and will be handled differently, simply by removing the other
emission.

panikweb/views.py

index a23f343f51463bd50710eb3a94bb4e08b85dd5df..56ebb0f33ddbccd22a57854b2c2b69824baa1ab9 100644 (file)
@@ -447,13 +447,10 @@ class Grid(TemplateView):
                                     # we set the cell time label to the longest
                                     # period
                                     grid[i][j].time_label = same_cell_below.time_label
-                                    # then we sort emissions, and if the start
-                                    # time is the same, the longest are put first
-                                    def cmp_schedule(x, y):
-                                        if x.datetime == y.datetime:
-                                            return -cmp(x.get_duration(), y.get_duration())
-                                        return cmp(x.datetime, y.datetime)
-                                    grid[i][j].schedules.sort(cmp_schedule)
+                                    # then we sort emissions so the longest are
+                                    # put first
+                                    grid[i][j].schedules.sort(
+                                            lambda x, y: -cmp(x.get_duration(), y.get_duration()))
                                     # then we add individual time labels to the
                                     # other schedules
                                     for schedule in current_cell_schedules: