Project

General

Profile

« Previous | Next » 

Revision db33aecd

Added by Benjamin Dauvergne over 12 years ago

agenda: do not show agenda containing only holidays (fix of previous implementation)

View differences:

calebasse/agenda/appointments.py
32 32
        self.weight = 0
33 33
        self.act_type = None
34 34
        self.validation = None
35
        self.holiday = False
35 36
        self.__set_time(begin_time)
36 37

  
37 38
    def __set_time(self, time):
......
106 107
        self.__set_time(begin_time)
107 108
        self.description = description
108 109

  
110
    def init_holiday_time(self, title, length, begin_time, description=None):
111
        self.init_busy_time(title, length, begin_time, description)
112
        self.holiday = True
113

  
109 114
    def init_start_stop(self, title, time):
110 115
        """
111 116
        title: Arrivee ou Depart
......
147 152
        delta_minutes = delta.seconds / 60
148 153
        appointment = Appointment()
149 154
        label = u"Congé (%s)" % holiday.holiday_type.name
150
        appointment.init_busy_time(label,
155
        appointment.init_holiday_time(label,
151 156
                    delta_minutes,
152 157
                    time(interval.lower_bound.hour, interval.lower_bound.minute),
153 158
                    description=holiday.comment)
calebasse/agenda/views.py
220 220
    template_name = 'agenda/act-validation.html'
221 221

  
222 222
    def acts_of_the_day(self):
223
        return [e.act for e in EventWithAct.objects.filter(patient__service=self.service)
224
                .today_occurrences(self.date)]
223
        acts = [e.act for e in EventWithAct.objects.filter(patient__service=self.service)
224
                .today_occurrences(self.date)] + list(Act.objects.filter(date=self.date, parent_event__isnull=True))
225
        return sorted(acts, key=lambda a: a.time)
225 226

  
226 227
    def post(self, request, *args, **kwargs):
227 228
        if 'unlock-all' in request.POST:
......
375 376
            holidays_workers[worker.id] = holidays_worker
376 377
            daily_appointments = get_daily_appointments(context['date'], worker, self.service,
377 378
                        time_tables_worker, events_worker, holidays_worker)
378
            if all(map(lambda x: x.type == 'busy-here', daily_appointments)):
379
            if all(map(lambda x: x.holiday, daily_appointments)):
379 380
                continue
380 381
            context['workers_agenda'].append({'worker': worker,
381 382
                    'appointments': daily_appointments})

Also available in: Unified diff