diff --git a/castellum/appointments/forms.py b/castellum/appointments/forms.py index 5b8e473f78de9a559dec8d1c1a8d5fcbd9e5aa32..371b9c29a794a88aa9973e34cb826262b16398cb 100644 --- a/castellum/appointments/forms.py +++ b/castellum/appointments/forms.py @@ -119,7 +119,6 @@ class AppointmentsForm(forms.ModelForm): self.appointment_changes.append((appointment.start, start)) appointment.start = start appointment.reminded = False - appointment.show_up = Appointment.SHOWUP # reset to default appointment.save() elif start: self.appointment_changes.append((None, start)) diff --git a/castellum/appointments/migrations/0003_remove_appointment_show_up.py b/castellum/appointments/migrations/0003_remove_appointment_show_up.py new file mode 100644 index 0000000000000000000000000000000000000000..1d92588a84970cc78992e4a5cf3beef06c67674b --- /dev/null +++ b/castellum/appointments/migrations/0003_remove_appointment_show_up.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2 on 2021-05-04 07:31 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('appointments', '0002_status_wording'), + ] + + operations = [ + migrations.RemoveField( + model_name='appointment', + name='show_up', + ), + ] diff --git a/castellum/appointments/models.py b/castellum/appointments/models.py index 7bcc61ab4f0fc765502bd17554efa9c6d28ec201..e957cb78de2610fa04665886eb1f75cccea70922 100644 --- a/castellum/appointments/models.py +++ b/castellum/appointments/models.py @@ -35,20 +35,6 @@ MINUTE = datetime.timedelta(seconds=60) class Appointment(models.Model): - SHOWUP = 1 - LATE = 2 - EXCUSED = 3 - NOSHOW = 4 - - SHOWUP_CHOICES = [ - (SHOWUP, _('no issues')), - (LATE, _('late')), - (EXCUSED, _('excused')), - (NOSHOW, _('no show')), - ] - - SHOWUP_OK = [SHOWUP, LATE] - session = models.ForeignKey(StudySession, verbose_name=_('Session'), on_delete=models.CASCADE) start = DateTimeField(_('Start')) reminded = models.BooleanField(_('Reminded'), default=False) @@ -57,7 +43,6 @@ class Appointment(models.Model): on_delete=models.CASCADE, verbose_name=_('Participation'), ) - show_up = models.SmallIntegerField(_('Show up'), default=SHOWUP, choices=SHOWUP_CHOICES) class Meta: verbose_name = _('Appointment') diff --git a/castellum/appointments/templatetags/appointments.py b/castellum/appointments/templatetags/appointments.py deleted file mode 100644 index ed24a42e3f4f7f9433a54dc2487482b16774f11b..0000000000000000000000000000000000000000 --- a/castellum/appointments/templatetags/appointments.py +++ /dev/null @@ -1,53 +0,0 @@ -# (c) 2018-2021 -# MPIB , -# MPI-CBS , -# MPIP -# -# This file is part of Castellum. -# -# Castellum is free software; you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Castellum is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Castellum. If not, see -# . - -from django import template -from django.utils.translation import gettext_lazy as _ - -from castellum.appointments.models import Appointment - -register = template.Library() - - -@register.filter -def showup_level(subject): - subject.annotate_showup_stats() - - if subject.showup_score > 6: - return 'danger' - elif subject.showup_score > 2: - return 'warning' - else: - return 'success' - - -@register.filter -def showup_summary(subject): - subject.annotate_showup_stats() - - labelled = [] - for status, label in Appointment.SHOWUP_CHOICES: - count = getattr(subject, 'showup_{}'.format(status)) - if count: - labelled.append((label, count)) - - formatted = ', '.join('{}: {}'.format(label, count) for label, count in labelled) - return formatted or _('no appointments so far') diff --git a/castellum/contacts/templates/contacts/__contact.html b/castellum/contacts/templates/contacts/__contact.html index 0fc344e9646c71870ae53da2eb91338904154f23..f42950614e0874201718766c7b030c0fa22652a0 100644 --- a/castellum/contacts/templates/contacts/__contact.html +++ b/castellum/contacts/templates/contacts/__contact.html @@ -1,4 +1,4 @@ -{% load i18n auth utils appointments %} +{% load i18n auth utils %} {% for guardian in subject.contact.guardians.all %} {% has_privacy_level guardian.subject.privacy_level user as can_access %} @@ -23,13 +23,3 @@ {% empty %} {% include 'contacts/__contact_detail.html' with contact=subject.contact %} {% endfor %} - -
-
{% translate "Show up rate" %}
-
- - {% with summary=subject|showup_summary %} - {% if summary %}({{ summary }}){% endif %} - {% endwith %} -
-
diff --git a/castellum/execution/templates/execution/participation_appointments.html b/castellum/execution/templates/execution/participation_appointments.html deleted file mode 100644 index 12b7eddcfbabd05cc66d470f11b9d62434498c64..0000000000000000000000000000000000000000 --- a/castellum/execution/templates/execution/participation_appointments.html +++ /dev/null @@ -1,34 +0,0 @@ -{% extends "execution/participation_base.html" %} -{% load i18n auth bootstrap4 utils %} - -{% block content %} -
- {% for session, appointment, form in appointments %} -
{{ session.name }}
-
- {% if appointment %} -
- -
- {% csrf_token %} - {% bootstrap_field form.show_up show_label=False %} - -
-
- {% else %} - — - {% endif %} -
- {% empty %} -
-
{% translate 'No sessions' %}
- {% endfor %} -
- - {% has_perm 'appointments.change_appointment' user study as can_change_appointment %} - {% if can_change_appointment %} - - {% endif %} -{% endblock %} diff --git a/castellum/execution/templates/execution/participation_detail.html b/castellum/execution/templates/execution/participation_detail.html index dc58bb5e533b094e71f67a86fe1c4d19affd80fd..851debbbf315431dfc195fb241a22d7a60fd8c07 100644 --- a/castellum/execution/templates/execution/participation_detail.html +++ b/castellum/execution/templates/execution/participation_detail.html @@ -1,5 +1,5 @@ {% extends "execution/participation_base.html" %} -{% load i18n utils auth appointments %} +{% load i18n utils auth %} {% block content %} {% if pseudonyms|length > 1 %} diff --git a/castellum/execution/templates/execution/study_base.html b/castellum/execution/templates/execution/study_base.html index 27e5c7f5a6af9672be04299ac968dfd6aa2c60a1..dfa7ff6313987c1c111d068f3fd35030603d9a82 100644 --- a/castellum/execution/templates/execution/study_base.html +++ b/castellum/execution/templates/execution/study_base.html @@ -1,5 +1,5 @@ {% extends "execution/base.html" %} -{% load i18n appointments %} +{% load i18n %} {% block title %}{{ study }} · {{ block.super }}{% endblock %} diff --git a/castellum/execution/templates/execution/study_detail.html b/castellum/execution/templates/execution/study_detail.html index fdd3840c162c4c83ca6a6ed226666cde33ac4ca3..3b6ea3254038d52331c83b7f4a6a10d998dd38ef 100644 --- a/castellum/execution/templates/execution/study_detail.html +++ b/castellum/execution/templates/execution/study_detail.html @@ -1,5 +1,5 @@ {% extends "execution/study_base.html" %} -{% load i18n appointments utils %} +{% load i18n utils %} {% block content %}
    @@ -8,9 +8,6 @@ {% if can_access %}
    {{ participation.subject.contact.full_name }} - {% with summary=participation.subject|showup_summary %} - - {% endwith %} {% if session_count > 0 %} {% icon 'calendar' label=_('Appointments') %} diff --git a/castellum/execution/urls.py b/castellum/execution/urls.py index 1461643d5670798a000eab3d5f44df95f8cf0674..c9c73d15a509ceb25fbc4f0f6faa65c7e77faeb4 100644 --- a/castellum/execution/urls.py +++ b/castellum/execution/urls.py @@ -32,14 +32,12 @@ from .views import ExclusionCriteriaView from .views import ExportView from .views import NewsMailView from .views import ParticipationAppointmentsUpdateView -from .views import ParticipationAppointmentsView from .views import ParticipationDetailView from .views import ParticipationNewsView from .views import ParticipationPseudonymsView from .views import ParticipationRemoveView from .views import ProgressView from .views import ResolveView -from .views import ShowUpUpdateView from .views import StudyDetailView app_name = 'execution' @@ -75,13 +73,8 @@ urlpatterns = [ ), path( '//appointments/', - ParticipationAppointmentsView.as_view(), - name='participation-appointments', - ), - path( - '//appointments/update/', ParticipationAppointmentsUpdateView.as_view(), - name='participation-appointments-update', + name='participation-appointments', ), path( '//update-contact/', @@ -103,9 +96,4 @@ urlpatterns = [ AdditionalInfoUpdateView.as_view(), name='additional-info-update', ), - path( - '//update-show-up/', - ShowUpUpdateView.as_view(), - name='show-up', - ), ] diff --git a/castellum/execution/views.py b/castellum/execution/views.py index 8dd524a5f11177948721ced218aede295ea7d890..f3d0ddb3b79eb0a3ed35ae8515ec5cf4724aa42d 100644 --- a/castellum/execution/views.py +++ b/castellum/execution/views.py @@ -22,7 +22,6 @@ import logging import zipfile -from django import forms from django.contrib import messages from django.core.exceptions import ObjectDoesNotExist from django.db import models @@ -40,7 +39,6 @@ from django.views.generic import UpdateView from castellum.appointments.forms import AppointmentsForm from castellum.appointments.mixins import BaseCalendarView from castellum.appointments.mixins import send_appointment_notifications -from castellum.appointments.models import Appointment from castellum.castellum_auth.mixins import PermissionRequiredMixin from castellum.contacts.mixins import BaseContactUpdateView from castellum.pseudonyms.forms import DomainForm @@ -56,7 +54,6 @@ from castellum.studies.mixins import StudyMixin from castellum.studies.models import Study from castellum.subjects.mixins import BaseAdditionalInfoUpdateView from castellum.subjects.mixins import BaseDataProtectionUpdateView -from castellum.subjects.models import Subject from castellum.utils.mail import MailContext from .forms import NewsMailForm @@ -81,9 +78,7 @@ class StudyDetailView(StudyMixin, PermissionRequiredMixin, DetailView): participations = self.study.participation_set\ .with_appointment_count()\ .filter(status=Participation.INVITED)\ - .prefetch_related( - models.Prefetch('subject', queryset=Subject.objects.annotate_showup()) - ) + .prefetch_related('subject') for participation in participations: has_access = self.request.user.has_privacy_level(participation.subject.privacy_level) context['list'].append((participation, has_access)) @@ -220,23 +215,6 @@ class ParticipationNewsView(ParticipationDetailMixin, UpdateView): return super().form_valid(form) -class ParticipationAppointmentsView(ParticipationDetailMixin, DetailView): - template_name = 'execution/participation_appointments.html' - tab = 'appointments' - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - - # The forms post to ShowUpUpdateView - context['appointments'] = [] - form_cls = forms.modelform_factory(Appointment, fields=['show_up']) - for session, appointment in self.object.get_appointments(): - form = form_cls(instance=appointment) - context['appointments'].append((session, appointment, form)) - - return context - - class ParticipationAppointmentsUpdateView(ParticipationDetailMixin, UpdateView): template_name = 'execution/participation_appointments_form.html' permission_required = ['recruitment.conduct_study', 'appointments.change_appointment'] @@ -251,35 +229,8 @@ class ParticipationAppointmentsUpdateView(ParticipationDetailMixin, UpdateView): def form_valid(self, form): response = super().form_valid(form) send_appointment_notifications(self.request, self.object, form.appointment_changes) - return response - - -class ShowUpUpdateView(ParticipationMixin, UpdateView): - # Used by ParticipationAppointmentsView - - model = Appointment - fields = ['show_up'] - http_method_names = ['post'] - permission_required = 'recruitment.conduct_study' - study_status = [Study.EXECUTION] - participation_status = [Participation.INVITED] - - def get_object(self): - return get_object_or_404( - Appointment, - pk=self.kwargs['appointment_pk'], - participation=self.participation, - ) - - def get_success_url(self): - return reverse( - 'execution:participation-appointments', - args=[self.kwargs['study_pk'], self.kwargs['pk']], - ) - - def form_valid(self, form): messages.success(self.request, _('Data has been saved.')) - return super().form_valid(form) + return response class ResolveView(StudyMixin, PermissionRequiredMixin, FormView): @@ -481,22 +432,13 @@ class CalendarView(StudyMixin, PermissionRequiredMixin, BaseCalendarView): tab = 'calendar' def render_appointment(self, appointment): - title = appointment.session.name - if appointment.show_up != Appointment.SHOWUP: - title = '{} ({})'.format(title, appointment.get_show_up_display()) - - class_names = [] - if appointment.show_up not in Appointment.SHOWUP_OK: - class_names.append('fullcalendar-muted') - return { - 'title': title, + 'title': appointment.session.name, 'start': appointment.start, 'end': appointment.end, 'url': reverse('execution:participation-detail', args=[ self.object.pk, appointment.participation.pk ]), - 'classNames': class_names, } def get_appointments(self): @@ -524,7 +466,6 @@ class ProgressView(StudyMixin, PermissionRequiredMixin, ListView): 'appointment', filter=models.Q( appointment__participation__status=Participation.INVITED, - appointment__show_up__in=Appointment.SHOWUP_OK, ), distinct=True, ), @@ -532,7 +473,6 @@ class ProgressView(StudyMixin, PermissionRequiredMixin, ListView): 'appointment', filter=models.Q( appointment__participation__status=Participation.INVITED, - appointment__show_up__in=Appointment.SHOWUP_OK, appointment__start__lte=timezone.now(), ), distinct=True, diff --git a/castellum/recruitment/models/participations.py b/castellum/recruitment/models/participations.py index 1004fd2ab75a788c56c586951943eae3e6792d88..19d70311621a62cbbfa362f0243d7648d27a1c16 100644 --- a/castellum/recruitment/models/participations.py +++ b/castellum/recruitment/models/participations.py @@ -82,14 +82,8 @@ class ParticipationManager(models.Manager): ) def with_appointment_count(self): - from castellum.appointments.models import Appointment - return self.get_queryset().annotate( - appointment_count=models.Count( - 'appointment', - filter=models.Q(appointment__show_up__in=Appointment.SHOWUP_OK), - distinct=True, - ) + appointment_count=models.Count('appointment', distinct=True) ) diff --git a/castellum/recruitment/templates/recruitment/contact.html b/castellum/recruitment/templates/recruitment/contact.html index 8a1c2f008f8a97b3ff2d16f80b4b20f56e039099..093fd88c74cd2f127591f06ebf70e83c7f753329 100644 --- a/castellum/recruitment/templates/recruitment/contact.html +++ b/castellum/recruitment/templates/recruitment/contact.html @@ -1,5 +1,5 @@ {% extends "recruitment/base.html" %} -{% load i18n static bootstrap4 utils auth appointments %} +{% load i18n static bootstrap4 utils auth %} {% block title %}{% translate "Recruitment" %} · {{ study }} · {{ block.super }}{% endblock %} diff --git a/castellum/recruitment/views.py b/castellum/recruitment/views.py index a732d1b53e02dbd4a3f4a90952b64374f1729b61..87c7024bde7fc9fc524794b12497ddd0fc494b02 100644 --- a/castellum/recruitment/views.py +++ b/castellum/recruitment/views.py @@ -566,7 +566,6 @@ class SchedulerPingView(View): appointment_changes.append((appointment.start, start)) appointment.start = start appointment.reminded = False - appointment.show_up = Appointment.SHOWUP # reset to default appointment.save() elif start: appointment_changes.append((None, start)) diff --git a/castellum/static/style.css b/castellum/static/style.css index 091a17d5a1d56b3724aa0623e438c7360b1658a5..a4579ca121cd2be73a91f92b6d7cebcbfcdc2588 100644 --- a/castellum/static/style.css +++ b/castellum/static/style.css @@ -139,10 +139,6 @@ opacity: 1; } -.fullcalendar-muted { - opacity: 60%; -} - @media print { .alert { display: none !important; diff --git a/castellum/subjects/models.py b/castellum/subjects/models.py index 75b20b5ca6ae99dd4bdace9d3b8aba9ca67261d3..866c2d68d77c6b5ccb0bef113a819e4d03042217 100644 --- a/castellum/subjects/models.py +++ b/castellum/subjects/models.py @@ -46,34 +46,6 @@ class TimeSlot(models.Model): return str(self.hour) -class SubjectQuerySet(models.QuerySet): - def annotate_showup(self): - from castellum.appointments.models import Appointment - - now = timezone.now() - weights = { - Appointment.SHOWUP: -1, - Appointment.LATE: 1, - Appointment.EXCUSED: 2, - Appointment.NOSHOW: 3, - } - - counts = {} - score = [] - for status, label in Appointment.SHOWUP_CHOICES: - key = 'showup_{}'.format(status) - counts[key] = models.Count( - 'participation__appointment', - filter=models.Q( - participation__appointment__show_up=status, - participation__appointment__start__lt=now, - ), - ) - score.append(models.F(key) * weights[status]) - - return self.annotate(**counts, showup_score=sum(score)) - - class Subject(TimeStampedModel): slug = models.CharField(_('Slug'), max_length=64, default=uuid_str, unique=True) @@ -156,8 +128,6 @@ class Subject(TimeStampedModel): not_available_until = DateTimeField(_("not available until"), blank=True, null=True) - objects = SubjectQuerySet.as_manager() - class Meta: verbose_name = _('Subject') permissions = [ @@ -263,18 +233,6 @@ class Subject(TimeStampedModel): else: return self.get_next_available_datetime(now) - def annotate_showup_stats(self): - from castellum.appointments.models import Appointment - - if hasattr(self, 'showup_score'): - return - - annotated = Subject.objects.annotate_showup().get(pk=self.pk) - self.showup_score = annotated.showup_score - for status, label in Appointment.SHOWUP_CHOICES: - key = 'showup_{}'.format(status) - setattr(self, key, getattr(annotated, key)) - def get_data(self): from castellum.recruitment.models import AttributeDescription diff --git a/castellum/subjects/templates/subjects/maintenance_base.html b/castellum/subjects/templates/subjects/maintenance_base.html index 871581268e0d047a79e350361e18d88447156d31..ea5ef3ad338ccfc32b885b89479af92d5fc53b21 100644 --- a/castellum/subjects/templates/subjects/maintenance_base.html +++ b/castellum/subjects/templates/subjects/maintenance_base.html @@ -25,9 +25,6 @@ - diff --git a/castellum/subjects/templates/subjects/maintenance_showup.html b/castellum/subjects/templates/subjects/maintenance_showup.html deleted file mode 100644 index 394659307e911ce85f159b9ea2ad9c067f4beaef..0000000000000000000000000000000000000000 --- a/castellum/subjects/templates/subjects/maintenance_showup.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends "subjects/maintenance_base.html" %} -{% load i18n bootstrap4 auth %} - -{% block title %}{% translate "Show up" %} · {{ block.super }}{% endblock %} - -{% block content %} -

    {% translate 'The following subjects have a record of coming late or not at all:' %}

    - -
      - {% for subject in object_list %} - {% has_privacy_level subject.privacy_level user as can_access %} -
    • -
      -
      - {% translate 'Last updated on' %}: {{ subject.updated_at|date }} -
      -
      -
      - {% if can_access %} - {% translate 'Details' %} - {% else %} - - {% endif %} -
      -
    • - {% empty %} - - {% endfor %} -
    - - {% if is_paginated %} - - {% endif %} -{% endblock %} diff --git a/castellum/subjects/templates/subjects/subject_detail.html b/castellum/subjects/templates/subjects/subject_detail.html index 41a7faf886218436c8056ac7f32ede1d3173b144..a1d9275f52d7122f1e1899b2c9dbf111b99a72b1 100644 --- a/castellum/subjects/templates/subjects/subject_detail.html +++ b/castellum/subjects/templates/subjects/subject_detail.html @@ -1,5 +1,5 @@ {% extends "subjects/subject_base.html" %} -{% load i18n bootstrap4 utils auth appointments %} +{% load i18n bootstrap4 utils auth %} {% block title %}{% translate "Subject details" %} · {{ block.super }}{% endblock %} @@ -47,14 +47,6 @@
    {% translate 'Attribute completeness' %}
    {{ attribute_completeness|default:'—' }}
    - -
    {% translate "Show up rate" %}
    -
    - - {% with summary=subject|showup_summary %} - {% if summary %}({{ summary }}){% endif %} - {% endwith %} -

    {% translate 'Legal basis for data processing' %}

    diff --git a/castellum/subjects/templates/subjects/subject_export.html b/castellum/subjects/templates/subjects/subject_export.html index 8ec32a6184687bb61956f01e9448c40d93106468..df99e425727bc0b7f682bf5ead4ec7fd9c94b4ff 100644 --- a/castellum/subjects/templates/subjects/subject_export.html +++ b/castellum/subjects/templates/subjects/subject_export.html @@ -208,9 +208,6 @@
    {{ appointment|verbose_name:'reminded' }}
    {{ appointment|display:'reminded' }}
    - -
    {{ appointment|verbose_name:'show_up' }}
    -
    {{ appointment|display:'show_up' }}
    {% endfor %} {% endif %} diff --git a/castellum/subjects/urls.py b/castellum/subjects/urls.py index bef050a5349d23cab9cde13afcd4ca907e3cb317..5ad462950cf707f4d0e88d3438846f92ca29aec9 100644 --- a/castellum/subjects/urls.py +++ b/castellum/subjects/urls.py @@ -32,7 +32,6 @@ from .views import MaintenanceConsentView from .views import MaintenanceContactView from .views import MaintenanceDuplicatesView from .views import MaintenanceNotesView -from .views import MaintenanceShowupView from .views import MaintenanceWaitingView from .views import ParticipationAddView from .views import ParticipationDeleteView @@ -60,7 +59,6 @@ urlpatterns = [ name='maintenance-duplicates', ), path('maintenance/waiting/', MaintenanceWaitingView.as_view(), name='maintenance-waiting'), - path('maintenance/showup/', MaintenanceShowupView.as_view(), name='maintenance-showup'), path('maintenance/notes/', MaintenanceNotesView.as_view(), name='maintenance-notes'), path('/', SubjectDetailView.as_view(), name='detail'), path('/delete/', SubjectDeleteView.as_view(), name='delete'), diff --git a/castellum/subjects/views.py b/castellum/subjects/views.py index 823930805acad77570aacecff0312a878ef9e477..59e12c071ca74cbb22ccea457aac9dbf45c0428f 100644 --- a/castellum/subjects/views.py +++ b/castellum/subjects/views.py @@ -643,22 +643,6 @@ class MaintenanceWaitingView(BaseMaintenanceView): ) -class MaintenanceShowupView(BaseMaintenanceView): - template_name = 'subjects/maintenance_showup.html' - tab = 'showup' - - def get_queryset(self): - return ( - Subject.objects - .annotate_showup() - .filter( - to_be_deleted__isnull=True, - showup_score__gte=6, - ) - .order_by('-showup_score') - ) - - class MaintenanceNotesView(BaseMaintenanceView): template_name = 'subjects/maintenance_notes.html' tab = 'notes' diff --git a/tests/execution/views/test_views.py b/tests/execution/views/test_views.py index 5092f03e56d051d2a3cc55931f4fd015657bbcc3..8b832c1404f29db1efb38125c90fa476b763a241 100644 --- a/tests/execution/views/test_views.py +++ b/tests/execution/views/test_views.py @@ -26,24 +26,20 @@ def test_study_detail_view(request, client, user_fixture, study_in_execution_sta def test_study_detail_view_appointment_count(client, member, study_in_execution_status): - session1 = baker.make(StudySession, study=study_in_execution_status) - session2 = baker.make(StudySession, study=study_in_execution_status) + session = baker.make(StudySession, study=study_in_execution_status) baker.make(StudySession, study=study_in_execution_status) participation = baker.make( Participation, status=Participation.INVITED, study=study_in_execution_status ) baker.make( - Appointment, participation=participation, session=session1, show_up=Appointment.SHOWUP - ) - baker.make( - Appointment, participation=participation, session=session2, show_up=Appointment.NOSHOW + Appointment, participation=participation, session=session ) client.force_login(member) url = '/execution/{}/'.format(study_in_execution_status.pk) response = client.get(url) print(response.content) - assert b'1/3' in response.content + assert b'1/2' in response.content @pytest.mark.smoketest diff --git a/tests/subjects/views/test_maintenance_views.py b/tests/subjects/views/test_maintenance_views.py index dbf1d334aa198327738bed6bda297d72d1a65f5e..876265eb4419331418f233f59cfe801c77743b26 100644 --- a/tests/subjects/views/test_maintenance_views.py +++ b/tests/subjects/views/test_maintenance_views.py @@ -6,7 +6,6 @@ import pytest from freezegun import freeze_time from model_bakery import baker -from castellum.appointments.models import Appointment from castellum.contacts.models import Contact from castellum.subjects.models import Consent @@ -151,31 +150,3 @@ def test_maintenance_waiting_200(request, client, user_fixture): url = '/subjects/maintenance/waiting/' response = client.get(url) assert response.status_code == 200 - - -@pytest.mark.smoketest -@pytest.mark.parametrize('user_fixture', [ - pytest.param('study_coordinator', marks=pytest.mark.xfail(strict=True)), - pytest.param('recruiter', marks=pytest.mark.xfail(strict=True)), - 'subject_manager', - pytest.param('data_protection_coordinator', marks=pytest.mark.xfail(strict=True)), -]) -def test_maintenance_showup_200(request, client, user_fixture): - user = request.getfixturevalue(user_fixture) - client.force_login(user) - url = '/subjects/maintenance/showup/' - response = client.get(url) - assert response.status_code == 200 - - -def test_maintenance_showup(client, user, participation): - past = timezone.now() - baker.make(Appointment, show_up=Appointment.NOSHOW, participation=participation, start=past) - baker.make(Appointment, show_up=Appointment.NOSHOW, participation=participation, start=past) - baker.make(Appointment, show_up=Appointment.NOSHOW, participation=participation, start=past) - - client.force_login(user) - url = '/subjects/maintenance/showup/' - response = client.get(url) - assert response.status_code == 200 - assert response.content.count(b'"table-list-item"') == 1