Project

General

Profile

« Previous | Next » 

Revision 477e1b65

Added by Frédéric Péters over 12 years ago

agenda: fix service activity columns (#2085)

View differences:

calebasse/agenda/views.py
76 76

  
77 77
        appointments_times = dict()
78 78
        appoinment_type = EventType.objects.get(id=1)
79
        meeting_type = EventType.objects.get(id=2)
79 80
        occurrences = Occurrence.objects.daily_occurrences(context['date'],
80 81
                services=[self.service],
81
                event_type=appoinment_type)
82
                event_type=[appoinment_type, meeting_type])
82 83
        for occurrence in occurrences:
83 84
            start_time = occurrence.start_time.strftime("%H:%M")
84 85
            if not appointments_times.has_key(start_time):
......
90 91
            if length.seconds:
91 92
                length = length.seconds / 60
92 93
                appointment['length'] = "%sm" % length
93
            event_act = occurrence.event.eventact
94
            appointment['patient'] = event_act.patient.display_name
94
            if occurrence.event.event_type == EventType.objects.get(id=1):
95
                appointment['type'] = 1
96
                event_act = occurrence.event.eventact
97
                appointment['label'] = event_act.patient.display_name
98
                appointment['act'] = event_act.act_type.name
99
            elif occurrence.event.event_type == EventType.objects.get(id=2):
100
                appointment['type'] = 2
101
                appointment['label'] = '%s - %s' % (occurrence.event.event_type.label,
102
                                                    occurrence.event.title)
103
            else:
104
                appointment['type'] = 0
105
                appointment['label'] = '???'
95 106
            appointment['therapists'] = ""
96 107
            for participant in occurrence.event.participants.all():
97 108
                appointment['therapists'] += participant.display_name + "; "
98 109
            if appointment['therapists']:
99 110
                appointment['therapists'] = appointment['therapists'][:-2]
100
            appointment['act'] = event_act.act_type.name
101 111
            appointments_times[start_time]['row'] += 1
102 112
            appointments_times[start_time]['appointments'].append(appointment)
103 113
        context['appointments_times'] = sorted(appointments_times.items())

Also available in: Unified diff