diff --git a/smash/web/models/study_subject_list.py b/smash/web/models/study_subject_list.py index de31e3cf04711d7909c80f56019597ef59605cb3..8813f34b1ac1bb0d5b86dd937779de26dbf79fd7 100644 --- a/smash/web/models/study_subject_list.py +++ b/smash/web/models/study_subject_list.py @@ -9,7 +9,7 @@ SUBJECT_LIST_REQUIRE_CONTACT = "REQUIRE_CONTACT" SUBJECT_LIST_VOUCHER_EXPIRY = "VOUCHER_EXPIRY" SUBJECT_LIST_CHOICES = { - SUBJECT_LIST_GENERIC: 'Generic', + SUBJECT_LIST_GENERIC: 'Generic subject list', SUBJECT_LIST_NO_VISIT: 'Subjects without visit', SUBJECT_LIST_REQUIRE_CONTACT: 'Subjects required contact', SUBJECT_LIST_VOUCHER_EXPIRY: 'Subject with vouchers to be expired soon' diff --git a/smash/web/models/study_visit_list.py b/smash/web/models/study_visit_list.py index e16c334ec9a97fcf953ea49fe36a454c0ccf49ba..3c49f094601deca34dc2d7199fdc5c26d4c96f1e 100644 --- a/smash/web/models/study_visit_list.py +++ b/smash/web/models/study_visit_list.py @@ -12,7 +12,7 @@ VISIT_LIST_APPROACHING_WITHOUT_APPOINTMENTS = "APPROACHING_WITHOUT_APPOINTMENTS" VISIT_LIST_APPROACHING_FOR_MAIL_CONTACT = "APPROACHING_FOR_MAIL_CONTACT" VISIT_LIST_CHOICES = { - VISIT_LIST_GENERIC: 'Generic', + VISIT_LIST_GENERIC: 'Generic visit list', VISIT_LIST_EXCEEDED_TIME: 'exceeded visit time', VISIT_LIST_UNFINISHED: 'unfinished visits', VISIT_LIST_MISSING_APPOINTMENTS: 'visits with missing appointments', diff --git a/smash/web/templates/appointments/list.html b/smash/web/templates/appointments/list.html index 24de957c72f74339e13d3d31e08ca4acdd50ce42..0df0378baa7ab4ce71dd8bf54755e56d346c39b0 100644 --- a/smash/web/templates/appointments/list.html +++ b/smash/web/templates/appointments/list.html @@ -9,10 +9,10 @@ {% endblock styles %} {% block ui_active_tab %}'appointments'{% endblock ui_active_tab %} -{% block page_header %}Appointments{% endblock page_header %} +{% block page_header %}{{ list_description }}{% endblock page_header %} {% block page_description %}{% endblock page_description %} -{% block title %}{{ block.super }} - Appointments{% endblock %} +{% block title %}{{ block.super }} - {{ list_description }}{% endblock %} {% block breadcrumb %} {% include "appointments/breadcrumb.html" %} diff --git a/smash/web/templates/subjects/index.html b/smash/web/templates/subjects/index.html index b3b4aaa0e0067bce58fcf61b60877ae8a2402610..4033c02dd8abdf84127be23da9a6441906c667d4 100644 --- a/smash/web/templates/subjects/index.html +++ b/smash/web/templates/subjects/index.html @@ -8,10 +8,10 @@ {% endblock styles %} {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %} -{% block page_header %}Subjects{% endblock page_header %} +{% block page_header %}{{ list_description }}{% endblock page_header %} {% block page_description %}{% endblock page_description %} -{% block title %}{{ block.super }} - Subjects{% endblock %} +{% block title %}{{ block.super }} - {{ list_description }}{% endblock %} {% block breadcrumb %} {% include "subjects/breadcrumb.html" %} diff --git a/smash/web/templates/visits/index.html b/smash/web/templates/visits/index.html index eb25d83536ca7336b78e770abc4c2e9aae082f63..568fa57a2118dbec974a425ead6e3e0349d490c5 100644 --- a/smash/web/templates/visits/index.html +++ b/smash/web/templates/visits/index.html @@ -10,10 +10,10 @@ {% endblock styles %} {% block ui_active_tab %}'visits'{% endblock ui_active_tab %} -{% block page_header %}Visits{% endblock page_header %} +{% block page_header %}{{ list_description }}{% endblock page_header %} {% block page_description %}{% endblock page_description %} -{% block title %}{{ block.super }} - Visits{% endblock %} +{% block title %}{{ block.super }} - {{ list_description }}{% endblock %} {% block breadcrumb %} {% include "visits/breadcrumb.html" %} @@ -40,6 +40,7 @@ function getVisitEditUrl(id) { return "{% url 'web.views.visit_details' 12345678 %}".replace(/12345678/, id); } + $.get("{% url 'web.api.visits.columns' visit_list_type %}", function (data) { createVisitsTable({ locations_url: "{% url 'web.api.locations' %}", diff --git a/smash/web/tests/test_RedcapConnector.py b/smash/web/tests/test_RedcapConnector.py index bde702f4d61a714bbc250727f356c5d20a36c3ed..0841fbfd4c2135ee9846a0cac8743ea1691a3815 100644 --- a/smash/web/tests/test_RedcapConnector.py +++ b/smash/web/tests/test_RedcapConnector.py @@ -1,6 +1,7 @@ # coding=utf-8 import logging +import unittest from django.test import TestCase @@ -14,6 +15,7 @@ from web.views.notifications import get_today_midnight_date logger = logging.getLogger(__name__) +# @unittest.skip("test redcap server is down") class TestRedcapConnector(TestCase): def test_invalid_configuration(self): redcap_connection = RedcapConnector() diff --git a/smash/web/tests/view/test_redcap.py b/smash/web/tests/view/test_redcap.py index 9026ee073d6a3952663e73cd19a54c64d845d02c..b169222bd9cec704beb4be1b606d8190c4b93002 100644 --- a/smash/web/tests/view/test_redcap.py +++ b/smash/web/tests/view/test_redcap.py @@ -1,4 +1,5 @@ import logging +import unittest from django.urls import reverse @@ -13,6 +14,7 @@ class RedcapViewTests(LoggedInTestCase): response = self.client.get(reverse('web.views.missing_redcap_subject')) self.assertEqual(response.status_code, 200) + # @unittest.skip("test redcap server is down") def test_render_workers_list_request_with_valid_connection(self): prepare_test_redcap_connection() @@ -23,6 +25,7 @@ class RedcapViewTests(LoggedInTestCase): response = self.client.get(reverse('web.views.inconsistent_redcap_subject')) self.assertEqual(response.status_code, 200) + # @unittest.skip("test redcap server is down") def test_render_add_worker_request_with_valid_connection(self): prepare_test_redcap_connection() diff --git a/smash/web/views/appointment.py b/smash/web/views/appointment.py index d45f67f8c6067ac2185519b3284e5f6ffd0c2b76..c4a9ddf1f5a37259e369de156f44b5ea6031d564 100644 --- a/smash/web/views/appointment.py +++ b/smash/web/views/appointment.py @@ -27,6 +27,7 @@ def appointments(request): def unfinished_appointments(request): context = { 'list_type': APPOINTMENT_LIST_UNFINISHED, + 'list_description': 'List of unfinished appointments' } return wrap_response(request, "appointments/list.html", context) diff --git a/smash/web/views/subject.py b/smash/web/views/subject.py index f8df4c1af40bbf68dd9012676ad5d7fb516b4ce2..4237d946668ea4ca628ceb3078eb55b3071440c1 100644 --- a/smash/web/views/subject.py +++ b/smash/web/views/subject.py @@ -9,19 +9,24 @@ from ..forms import VisitDetailForm, SubjectAddForm, SubjectEditForm, StudySubje from ..models import StudySubject, MailTemplate, Worker, Study from ..models.constants import GLOBAL_STUDY_ID from ..models.study_subject_list import SUBJECT_LIST_GENERIC, SUBJECT_LIST_NO_VISIT, SUBJECT_LIST_REQUIRE_CONTACT, \ - SUBJECT_LIST_VOUCHER_EXPIRY + SUBJECT_LIST_VOUCHER_EXPIRY, SUBJECT_LIST_CHOICES logger = logging.getLogger(__name__) -def subjects(request): +def subject_list(request, subject_list_type): context = { - 'list_type': SUBJECT_LIST_GENERIC, - 'worker': Worker.get_by_user(request.user) + 'list_type': subject_list_type, + 'worker': Worker.get_by_user(request.user), + 'list_description': SUBJECT_LIST_CHOICES[subject_list_type], } return wrap_response(request, 'subjects/index.html', context) +def subjects(request): + return subject_list(request, SUBJECT_LIST_GENERIC) + + def subject_add(request): study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0] if request.method == 'POST': @@ -47,24 +52,15 @@ def subject_add(request): def subject_no_visits(request): - context = { - 'list_type': SUBJECT_LIST_NO_VISIT, - } - return wrap_response(request, 'subjects/index.html', context) + return subject_list(request, SUBJECT_LIST_NO_VISIT) def subject_voucher_expiry(request): - context = { - 'list_type': SUBJECT_LIST_VOUCHER_EXPIRY, - } - return wrap_response(request, 'subjects/index.html', context) + return subject_list(request, SUBJECT_LIST_VOUCHER_EXPIRY) def subject_require_contact(request): - context = { - 'list_type': SUBJECT_LIST_REQUIRE_CONTACT, - } - return wrap_response(request, 'subjects/index.html', context) + return subject_list(request, SUBJECT_LIST_REQUIRE_CONTACT) def subject_edit(request, id): diff --git a/smash/web/views/visit.py b/smash/web/views/visit.py index 7a1e821b71fe0b36b4b49d0ac2de19eaadefa8af..96dde765288b7b54fd87468952d6a742e2fd133a 100644 --- a/smash/web/views/visit.py +++ b/smash/web/views/visit.py @@ -6,7 +6,7 @@ from django.shortcuts import get_object_or_404, redirect from notifications import waiting_for_appointment from web.models.study_visit_list import VISIT_LIST_GENERIC, VISIT_LIST_MISSING_APPOINTMENTS, \ VISIT_LIST_APPROACHING_WITHOUT_APPOINTMENTS, VISIT_LIST_APPROACHING_FOR_MAIL_CONTACT, VISIT_LIST_EXCEEDED_TIME, \ - VISIT_LIST_UNFINISHED + VISIT_LIST_UNFINISHED, VISIT_LIST_CHOICES from . import wrap_response from ..forms import VisitDetailForm, VisitAddForm, SubjectDetailForm, StudySubjectDetailForm from ..models import Visit, Appointment, StudySubject, MailTemplate @@ -15,7 +15,11 @@ logger = logging.getLogger(__name__) def show_visits(request, visit_list_type): - return wrap_response(request, 'visits/index.html', {'visit_list_type': visit_list_type}) + context = { + 'visit_list_type': visit_list_type, + 'list_description': VISIT_LIST_CHOICES[visit_list_type] + } + return wrap_response(request, 'visits/index.html', context) def visits(request):