From 511237b0c0e2456341b8c2a0e2070cf5eca41c20 Mon Sep 17 00:00:00 2001 From: Serghei MIHAI Date: Mon, 15 Sep 2014 15:11:34 +0200 Subject: [PATCH 1/2] departures displayed before arrivals in timetables Closes #5465 --- calebasse/agenda/appointments.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/calebasse/agenda/appointments.py b/calebasse/agenda/appointments.py index 2067668..b9f9195 100644 --- a/calebasse/agenda/appointments.py +++ b/calebasse/agenda/appointments.py @@ -191,6 +191,7 @@ def get_daily_appointments(date, worker, service, time_tables, events, holidays) appointment.type = 'busy-elsewhere' appointment.other_services_names = [s.slug for s in services if s != service] appointments.append(appointment) + print "time tables: %s" % time_tables for time_table in time_tables: interval_set = IntervalSet.between(time_table.to_interval(date).lower_bound.time(), time_table.to_interval(date).upper_bound.time()) @@ -214,13 +215,13 @@ def get_daily_appointments(date, worker, service, time_tables, events, holidays) appointment.other_services_names = services appointment.init_start_stop(u"Arrivée", start_time, appointment_type) activity['arrival'] = start_time - appointment.weight = -1 + appointment.weight = 1 appointments.append(appointment) appointment = Appointment() appointment.init_start_stop(u"Départ", end_time, appointment_type) appointment.other_services_names = services activity['departure'] = end_time - appointment.weight = 1 + appointment.weight = -1 appointments.append(appointment) return activity, sorted(appointments, key=lambda app: (app.begin_time, app.weight, app.event_id)) -- 2.1.0