diff --git a/smash/web/models.py b/smash/web/models.py index 44487b7f6c046608eec9d8c171e746e5354f8a2a..df643b52c319b0776f61d4d975ba0baf286089b4 100644 --- a/smash/web/models.py +++ b/smash/web/models.py @@ -205,11 +205,8 @@ class Visit(models.Model): return "%s %s" % (self.subject.first_name, self.subject.last_name) def follow_up_title(self): - visits = Visit.objects.filter(subject=self.subject, datetime_begin__lt =self.datetime_begin) - if len(visits)==0: - return "First visit" - else: - return "Follow up "+str(len(visits)) + count = Visit.objects.filter(subject=self.subject, datetime_begin__lt =self.datetime_begin).count() + return "Visit " + str(count + 1) def mark_as_finished(self): self.is_finished = True diff --git a/smash/web/templates/appointments/index.html b/smash/web/templates/appointments/index.html index c440bab2db3df666951f494dd723c02cae913f32..624a8797f7631e00d8f9c9da5f987490bffe8b8e 100644 --- a/smash/web/templates/appointments/index.html +++ b/smash/web/templates/appointments/index.html @@ -67,6 +67,7 @@ <thead> <tr> <th>Subject</th> + <th>Visit</th> <th>Type</th> <th>Date</th> <th>Details</th> @@ -76,13 +77,19 @@ {% for approach in approaching_list %} <tr> - <td> {% if approach.visit.subject.screening_number == "---" %} - N/A + <td> + </td> + <td> + </td> {% else %} - {{ approach.visit.subject.first_name }} {{ approach.visit.subject.last_name }} + <td> + {{ approach.visit.subject.first_name }} {{ approach.visit.subject.last_name }} ({{ approach.visit.subject.nd_number }}) + </td> + <td> + {{ approach.visit.follow_up_title }} + </td> {% endif %} - </td> <td> {% for type in approach.appointment_types.all %} {{ type.code }},