Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.2.8 on 2025-12-15 13:59

import datetime
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('clinics', '0018_userassignment_roles'),
]

operations = [
migrations.AddField(
model_name='clinicslot',
name='starts_at_time',
field=models.TimeField(default=datetime.time(13, 59, 56, 682231)),
preserve_default=False,
),
]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0018_userassignment_roles
0019_clinicslot_starts_at_time
1 change: 1 addition & 0 deletions manage_breast_screening/clinics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class ClinicSlot(BaseModel):
"clinics.Clinic", on_delete=models.PROTECT, related_name="clinic_slots"
)
starts_at = models.DateTimeField()
starts_at_time = models.TimeField()
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably make this nullable in this first migration so as we don't get the default value set. It probably doesn't matter as we don't have any existing data, well, we do but it's demo data and we're going to repopulate it anyway but good practice to get into I think. Make it nullable -> populate them all -> make it un-nullable in the subsequent PR when we get rid of starts_at.

duration_in_minutes = models.IntegerField()

@property
Expand Down
1 change: 1 addition & 0 deletions manage_breast_screening/clinics/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class Meta:
starts_at = Sequence(
lambda n: datetime(2025, 1, 1, 9, tzinfo=timezone.utc) + timedelta(hours=n)
)
starts_at_time = LazyAttribute(lambda o: o.starts_at.time())
duration_in_minutes = 15


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,14 @@ def create_slot(self, clinic, slot_key):
datetime.strptime(slot_key["starts_at_time"], "%H:%M").time(),
)

starts_at_time = datetime.strptime(slot_key["starts_at_time"], "%H:%M").time()

clinic_slot = ClinicSlotFactory(
clinic=clinic,
id=slot_key["id"],
duration_in_minutes=slot_key["duration_in_minutes"],
starts_at=starts_at,
starts_at_time=starts_at_time,
)

if "appointment" in slot_key:
Expand Down