From dd49cb12ee656b8fad01d5e7c6ef79da04a51a33 Mon Sep 17 00:00:00 2001
From: Carlos Vega <carlos.vega@uni.lu>
Date: Wed, 22 Apr 2020 19:21:05 +0200
Subject: [PATCH] replaced tuple with dict so that properties are better read.
 also, use display_visit_number filter

---
 smash/web/views/subject.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/smash/web/views/subject.py b/smash/web/views/subject.py
index ef65d5f4..1583412a 100644
--- a/smash/web/views/subject.py
+++ b/smash/web/views/subject.py
@@ -152,12 +152,14 @@ def subject_visit_details(request, id):
     visits_data = []
     allow_add_visit = True
     for visit in visits:
-        appointments = visit.appointment_set.all()
-        finished = visit.is_finished
-        visit_id = visit.id
-        visit_title = "Visit " + str(visit.visit_number)
-        visit_form = VisitDetailForm(instance=visit)
-        visits_data.append((visit_form, appointments, finished, visit_id, visit_title))
+        data = {
+            'visit_form': VisitDetailForm(instance=visit),
+            'appointments': visit.appointment_set.all(),
+            'finished': visit.is_finished,
+            'visit_id': visit.id,
+            'visit_number': visit.visit_number
+        }
+        visits_data.append(data)
         if not visit.is_finished:
             allow_add_visit = False
         if not study_subject_to_be_viewed.can_schedule():
-- 
GitLab