Projet

Général

Profil

« Précédent | Suivant » 

Révision 6ab97b79

Ajouté par Serghei Mihai (congés, retour 15/05) il y a plus de 9 ans

agenda: displaying free periods only for current service in scheduled and
availability bar

Voir les différences:

calebasse/agenda/appointments.py
143 143

  
144 144
    timetables_set = IntervalSet((t.to_interval(date) for t in time_tables))
145 145
    holidays_set = IntervalSet((h.to_interval(date) for h in holidays))
146
    busy_occurrences_set = IntervalSet((o.to_interval() for o in events if not o.is_event_absence()))
146
    busy_occurrences_set = IntervalSet((o.to_interval() for o in events if not o.is_event_absence() and service in o.services.all()))
147 147
    for free_time in timetables_set - (busy_occurrences_set+holidays_set):
148 148
        if free_time:
149 149
            delta = free_time.upper_bound - free_time.lower_bound
......
218 218
        appointment.init_start_stop(u"Arrivée", start_time, 'arrival',
219 219
                                    appointment_kind)
220 220
        activity['arrival'] = start_time
221
        appointment.weight = 1
221
        appointment.weight = -1
222 222
        appointments.append(appointment)
223 223
        appointment = Appointment()
224 224
        appointment.init_start_stop(u"Départ", end_time, 'departure',
calebasse/agenda/views.py
533 533
                .select_related()
534 534
        events = Event.objects.for_today(self.date) \
535 535
                .exclude(event_type_id=1) \
536
                .filter(participants=worker, services=self.service) \
536
                .filter(participants=worker) \
537 537
                .order_by('start_datetime') \
538 538
                .select_related() \
539 539
                .prefetch_related('services',
540 540
                        'exceptions',
541 541
                        'participants')
542 542
        eventswithact = EventWithAct.objects.for_today(self.date) \
543
                .filter(participants=worker, services=self.service) \
543
                .filter(participants=worker) \
544 544
                .order_by('start_datetime') \
545 545
                .select_related() \
546 546
                .prefetch_related('patient__addresses',
......
592 592
                                           self.date.day, 8, 0)
593 593
        end_datetime = datetime.datetime(self.date.year, self.date.month,
594 594
                                         self.date.day, 8, 15)
595
        events = Event.objects.filter(ressource__id=ressource_id,
596
                                      services=self.service).today_occurrences(self.date)
595
        events = Event.objects.filter(ressource__id=ressource_id).today_occurrences(self.date)
597 596

  
598 597
        while (start_datetime.hour <= 19):
599 598
            if start_datetime.hour not in disponibility:
......
628 627
                filter(services=self.service, worker=worker). \
629 628
                for_today(self.date). \
630 629
                order_by('start_date')
631
        holidays = Holiday.objects.for_worker(worker). \
630
        holidays = Holiday.objects.for_worker(worker).for_service(self.service). \
632 631
                for_period(self.date, self.date). \
633 632
                order_by('start_date')
634 633
        events = Event.objects.for_today(self.date) \
635 634
                .exclude(event_type_id=1) \
636
                .filter(services=self.service, participants=worker) \
635
                .filter(participants=worker, services=self.service) \
637 636
                .order_by('start_datetime') \
638 637
                .select_related() \
639 638
                .prefetch_related('participants', 'exceptions')
640 639
        eventswithact = EventWithAct.objects.for_today(self.date) \
641
                .filter(services=self.service, participants=worker) \
640
                .filter(participants=worker, services=self.service) \
642 641
                .order_by('start_datetime') \
643 642
                .select_related() \
644 643
                .prefetch_related('participants', 'exceptions',

Formats disponibles : Unified diff