Project

General

Profile

« Previous | Next » 

Revision e5d0f8c5

Added by Jérôme Schneider over 12 years ago

agenda: fix appointments order and free time begin hour

View differences:

calebasse/agenda/appointments.py
25 25
        self.event_id = None
26 26
        self.service = None
27 27
        self.workers_initial = None
28
        self.weight = 0
28 29
        self.act_type = None
29 30
        self.__set_time(begin_time)
30 31

  
......
92 93
            delta_minutes = delta.seconds / 60
93 94
            appointment = Appointment()
94 95
            appointment.init_free_time(delta_minutes,
95
                    time(free_time.lower_bound.hour, free_time.upper_bound.minute))
96
                    time(free_time.lower_bound.hour, free_time.lower_bound.minute))
96 97
            appointments.append(appointment)
97 98
    for occurrence in occurrences:
98 99
        appointment = Appointment()
......
102 103
        appointment = Appointment()
103 104
        appointment.init_start_stop(u"Arrivée",
104 105
            time(time_table.start_time.hour, time_table.start_time.minute))
106
        appointment.weight = -1
105 107
        appointments.append(appointment)
106 108
        appointment = Appointment()
107 109
        appointment.init_start_stop(u"Départ",
108 110
            time(time_table.end_time.hour, time_table.end_time.minute))
111
        appointment.weight = 1
109 112
        appointments.append(appointment)
110 113

  
111
    appointments = sorted(appointments, key=lambda app: app.begin_time)
112
    return appointments
114
    s = sorted(appointments, key=lambda app: app.weight)
115
    return sorted(s, key=lambda app: app.begin_time)
113 116

  

Also available in: Unified diff