Project

General

Profile

« Previous | Next » 

Revision 3465089e

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

agenda: service activity order by hours

View differences:

calebasse/agenda/views.py
1 1
import datetime
2
import collections
2 3

  
3 4
from django.db.models import Q
4 5
from django.shortcuts import redirect
......
76 77
        appoinment_type = EventType.objects.get(id=1)
77 78
        occurrences = Occurrence.objects.daily_occurrences(context['date'],
78 79
                services=[self.service],
79
                event_type=appoinment_type).order_by('start_time')
80
                event_type=appoinment_type)
80 81
        for occurrence in occurrences:
81 82
            start_time = occurrence.start_time.strftime("%H:%M")
82 83
            if not appointments_times.has_key(start_time):
......
89 90
                length = length.seconds / 60
90 91
                appointment['length'] = "%sm" % length
91 92
            event_act = occurrence.event.eventact
92
            appointment['patient'] = event_act.patient
93
            appointment['patient'] = event_act.patient.display_name
93 94
            appointment['therapists'] = ""
94 95
            for participant in occurrence.event.participants.all():
95
                appointment['therapists'] += str(participant) + "; "
96
                appointment['therapists'] += participant.display_name + "; "
96 97
            if appointment['therapists']:
97 98
                appointment['therapists'] = appointment['therapists'][:-2]
98 99
            appointment['act'] = event_act.act_type.name
99 100
            appointments_times[start_time]['row'] += 1
100 101
            appointments_times[start_time]['appointments'].append(appointment)
101
        context['appointments_times'] = appointments_times
102
        print context['appointments_times']
102
        context['appointments_times'] = collections.OrderedDict(sorted(appointments_times.items()))
103 103
        return context
104 104

  
105 105

  

Also available in: Unified diff