From df23b0cdc780cfeae67ee5d433150ff5994df832 Mon Sep 17 00:00:00 2001 From: Cameron Hargreaves Date: Wed, 17 Dec 2025 16:33:44 +0000 Subject: [PATCH 1/4] Change date/time font colour to grey this has been changed to fit in with design standards as the date/time font is a secondary text --- manage_breast_screening/clinics/jinja2/clinics/index.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manage_breast_screening/clinics/jinja2/clinics/index.jinja b/manage_breast_screening/clinics/jinja2/clinics/index.jinja index cb6a61c44..8cf6b17d4 100644 --- a/manage_breast_screening/clinics/jinja2/clinics/index.jinja +++ b/manage_breast_screening/clinics/jinja2/clinics/index.jinja @@ -59,7 +59,7 @@ {{ presented_clinic.type }}
- {{ presented_clinic.risk_type }} + {{ presented_clinic.risk_type }} From 745d7f0907aafdf197b863b96f41dcd2b1223d70 Mon Sep 17 00:00:00 2001 From: Cameron Hargreaves Date: Thu, 18 Dec 2025 11:55:39 +0000 Subject: [PATCH 2/4] Remove clinic type column As all of our clinical types will be Screening this column is redundant information --- manage_breast_screening/clinics/jinja2/clinics/index.jinja | 7 ------- 1 file changed, 7 deletions(-) diff --git a/manage_breast_screening/clinics/jinja2/clinics/index.jinja b/manage_breast_screening/clinics/jinja2/clinics/index.jinja index 8cf6b17d4..5b419033b 100644 --- a/manage_breast_screening/clinics/jinja2/clinics/index.jinja +++ b/manage_breast_screening/clinics/jinja2/clinics/index.jinja @@ -37,7 +37,6 @@ Location Date and time - Clinic type Participants Status @@ -56,12 +55,6 @@ {{ presented_clinic.starts_at | no_wrap }}
{{presented_clinic.time_range | as_hint }} - - {{ presented_clinic.type }} -
- {{ presented_clinic.risk_type }} - - {{ presented_clinic.number_of_slots }} From 129f03746c97382b506da4e567e12057e7aa7439 Mon Sep 17 00:00:00 2001 From: Cameron Hargreaves Date: Fri, 19 Dec 2025 10:47:02 +0000 Subject: [PATCH 3/4] Add provider onto clinic list page Added to fit in line with the prototype after snagging session --- .../clinics/jinja2/clinics/index.jinja | 9 ++++++++- manage_breast_screening/clinics/views.py | 6 +++++- .../tests/system/clinical/test_clinic_show_page.py | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/manage_breast_screening/clinics/jinja2/clinics/index.jinja b/manage_breast_screening/clinics/jinja2/clinics/index.jinja index 5b419033b..a614402f6 100644 --- a/manage_breast_screening/clinics/jinja2/clinics/index.jinja +++ b/manage_breast_screening/clinics/jinja2/clinics/index.jinja @@ -5,7 +5,14 @@ {% from 'components/secondary-navigation/macro.jinja' import app_secondary_navigation %} {% block page_content %} -

{{ presenter.heading }}

+

+ +{{ provider_name }} + + {{ + presenter.heading + }} +

{% set ns = namespace() %} {% set ns.secondaryNavItems = [] %} diff --git a/manage_breast_screening/clinics/views.py b/manage_breast_screening/clinics/views.py index a746a1d5d..1b8eb734f 100644 --- a/manage_breast_screening/clinics/views.py +++ b/manage_breast_screening/clinics/views.py @@ -18,7 +18,11 @@ def clinic_list(request, filter="today"): return render( request, "clinics/index.jinja", - context={"presenter": presenter, "page_title": presenter.heading}, + context={ + "presenter": presenter, + "page_title": presenter.heading, + "provider_name": provider.name, + }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_clinic_show_page.py b/manage_breast_screening/tests/system/clinical/test_clinic_show_page.py index 9d9edc360..2fe49b18f 100644 --- a/manage_breast_screening/tests/system/clinical/test_clinic_show_page.py +++ b/manage_breast_screening/tests/system/clinical/test_clinic_show_page.py @@ -115,6 +115,8 @@ def and_there_are_appointments(self): def and_i_am_on_the_clinic_list(self): self.page.goto(self.live_server_url + reverse("clinics:index")) self.assert_page_title_contains("Today’s clinics") + heading = self.page.get_by_role("heading", level=1) + expect(heading).to_contain_text(self.current_provider.name) def and_i_am_on_the_clinic_show_page(self): self.page.goto( From 96492fec962aaedc40d143f1bba9ec99b0007412 Mon Sep 17 00:00:00 2001 From: Cameron Hargreaves Date: Tue, 23 Dec 2025 01:05:19 +0000 Subject: [PATCH 4/4] Change 'all' filtering to only include clinics from the last 7 days This has been changed as if we collect all clinics, this list will grow very large and will get out of control very quick. This has been changed to the last 7 days and can be more digestable --- .../clinics/jinja2/clinics/index.jinja | 8 ++----- manage_breast_screening/clinics/models.py | 12 ++++++---- .../clinics/tests/test_models.py | 23 +++++++++++++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/manage_breast_screening/clinics/jinja2/clinics/index.jinja b/manage_breast_screening/clinics/jinja2/clinics/index.jinja index a614402f6..e00f39e6e 100644 --- a/manage_breast_screening/clinics/jinja2/clinics/index.jinja +++ b/manage_breast_screening/clinics/jinja2/clinics/index.jinja @@ -6,12 +6,8 @@ {% block page_content %}

- -{{ provider_name }} - - {{ - presenter.heading - }} + {{ provider_name }} + {{ presenter.heading }}

{% set ns = namespace() %} diff --git a/manage_breast_screening/clinics/models.py b/manage_breast_screening/clinics/models.py index c0b368ff6..19461c0e9 100644 --- a/manage_breast_screening/clinics/models.py +++ b/manage_breast_screening/clinics/models.py @@ -1,5 +1,5 @@ import uuid -from datetime import date +from datetime import date, timedelta from enum import StrEnum from django.conf import settings @@ -60,7 +60,7 @@ def by_filter(self, filter: str): case ClinicFilter.COMPLETED: return self.completed() case ClinicFilter.ALL: - return self + return self.last_seven_days() case _: raise ValueError(filter) @@ -76,6 +76,9 @@ def upcoming(self): """ return self.filter(starts_at__date__gt=date.today()) + def last_seven_days(self): + return self.filter(starts_at__date__gte=(date.today() - timedelta(days=7))) + def completed(self): """ Completed clinics that started in the past @@ -89,7 +92,8 @@ def completed(self): ) return ( - self.filter(starts_at__date__lt=date.today()) + self.last_seven_days() + .filter(starts_at__date__lt=date.today()) .annotate(latest_status=Subquery(latest_status)) .filter(latest_status__in=["CLOSED", "CANCELLED"]) .order_by("-ends_at") @@ -161,7 +165,7 @@ def filter_counts(cls, provider_id): queryset = cls.objects.filter(setting__provider_id=provider_id) return { - ClinicFilter.ALL: queryset.count(), + ClinicFilter.ALL: queryset.last_seven_days().count(), ClinicFilter.TODAY: queryset.today().count(), ClinicFilter.UPCOMING: queryset.upcoming().count(), ClinicFilter.COMPLETED: queryset.completed().count(), diff --git a/manage_breast_screening/clinics/tests/test_models.py b/manage_breast_screening/clinics/tests/test_models.py index 51ede91bb..46c509bea 100644 --- a/manage_breast_screening/clinics/tests/test_models.py +++ b/manage_breast_screening/clinics/tests/test_models.py @@ -101,6 +101,29 @@ def test_clean_clinic_slots(): clinic_slot.clean() +@time_machine.travel(datetime(2025, 1, 1, 10, tzinfo=tz.utc)) +@pytest.mark.django_db +def test_last_seven_days_all_filtering(): + _clinic1 = ClinicFactory.create( + starts_at=datetime(2024, 12, 1, 9, tzinfo=tz.utc), + ends_at=datetime(2024, 12, 1, 17, tzinfo=tz.utc), + current_status=models.ClinicStatus.CLOSED, + ) + _clinic2 = ClinicFactory.create( + starts_at=datetime(2024, 12, 2, 9, tzinfo=tz.utc), + ends_at=datetime(2024, 12, 2, 17, tzinfo=tz.utc), + current_status=models.ClinicStatus.CLOSED, + ) + clinic3 = ClinicFactory.create( + starts_at=datetime(2024, 12, 29, 9, tzinfo=tz.utc), + ends_at=datetime(2024, 12, 29, 17, tzinfo=tz.utc), + current_status=models.ClinicStatus.CLOSED, + ) + + last_seven_days_clinics = models.Clinic.objects.last_seven_days() + assertQuerySetEqual(last_seven_days_clinics, [clinic3]) + + class TestUserAssignment: def test_str(self): user = UserFactory.build(first_name="John", last_name="Doe")