Skip to content

Fix date/time bug#1201

Merged
cameronhargreaves1-nhs merged 1 commit intomainfrom
DTOSS-12483-scheduled-date-time-bug
Mar 19, 2026
Merged

Fix date/time bug#1201
cameronhargreaves1-nhs merged 1 commit intomainfrom
DTOSS-12483-scheduled-date-time-bug

Conversation

@cameronhargreaves1-nhs
Copy link
Contributor

@cameronhargreaves1-nhs cameronhargreaves1-nhs commented Mar 19, 2026

  • change clinic.starts_at to clinic_slot.starts_at

Description

image

Jira link

DTOSS-12483

Review notes

Review checklist

  • Check database queries are correctly scoped to current_provider

@swebberuk
Copy link
Contributor

Change looks good. Works for me.

I think we should add a unit test for this. We already have tests for ClinicSlotPresenter in TestClinicSlotPresenter of test_appointment_presenters.py but looks like we never added a test for slot_timestamp_single_line.

Think following test will be sufficient. Without the change in this PR it fails as slot_timestamp_single_line wrongly returns 2 January 2025 (4 months ago) \n 9am (30 minutes). With change in this PR then the test passes.

    @time_machine.travel(datetime(2025, 5, 19, tzinfo=tz.utc))
    def test_slot_timestamp_single_line(self, clinic_slot_mock):
        clinic_slot_mock.starts_at = datetime(2025, 1, 2, 10, 30)
        clinic_slot_mock.duration_in_minutes = 30
        clinic_slot_mock.clinic.starts_at = datetime(2025, 1, 2, 9, 0)

        assert (
            ClinicSlotPresenter(clinic_slot_mock).slot_timestamp_single_line
            == 
            "2 January 2025 (4 months ago) \n 10:30am (30 minutes)"
        )

@cameronhargreaves1-nhs cameronhargreaves1-nhs force-pushed the DTOSS-12483-scheduled-date-time-bug branch from ca8aed3 to 0116fc8 Compare March 19, 2026 11:42
Copy link
Contributor

@swebberuk swebberuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

- change clinic.starts_at to clinic_slot.starts_at
@cameronhargreaves1-nhs cameronhargreaves1-nhs force-pushed the DTOSS-12483-scheduled-date-time-bug branch from 0116fc8 to aa9946d Compare March 19, 2026 12:07
@sonarqubecloud
Copy link

@cameronhargreaves1-nhs cameronhargreaves1-nhs merged commit 2f9c31b into main Mar 19, 2026
12 checks passed
@cameronhargreaves1-nhs cameronhargreaves1-nhs deleted the DTOSS-12483-scheduled-date-time-bug branch March 19, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants