Skip to content

Commit 5c72140

Browse files
add ClinicSlot starts_at_time field
1 parent 30a6089 commit 5c72140

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Generated by Django 5.2.8 on 2025-12-15 13:59
2+
3+
import datetime
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('clinics', '0018_userassignment_roles'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='clinicslot',
16+
name='starts_at_time',
17+
field=models.TimeField(default=datetime.time(13, 59, 56, 682231)),
18+
preserve_default=False,
19+
),
20+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0018_userassignment_roles
1+
0019_clinicslot_starts_at_time

manage_breast_screening/clinics/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class ClinicSlot(BaseModel):
175175
"clinics.Clinic", on_delete=models.PROTECT, related_name="clinic_slots"
176176
)
177177
starts_at = models.DateTimeField()
178+
starts_at_time = models.TimeField()
178179
duration_in_minutes = models.IntegerField()
179180

180181
@property

manage_breast_screening/clinics/tests/factories.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class Meta:
8585
starts_at = Sequence(
8686
lambda n: datetime(2025, 1, 1, 9, tzinfo=timezone.utc) + timedelta(hours=n)
8787
)
88+
starts_at_time = LazyAttribute(lambda o: o.starts_at.time())
8889
duration_in_minutes = 15
8990

9091

manage_breast_screening/nonprod/management/commands/seed_demo_data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,14 @@ def create_slot(self, clinic, slot_key):
141141
datetime.strptime(slot_key["starts_at_time"], "%H:%M").time(),
142142
)
143143

144+
starts_at_time = datetime.strptime(slot_key["starts_at_time"], "%H:%M").time()
145+
144146
clinic_slot = ClinicSlotFactory(
145147
clinic=clinic,
146148
id=slot_key["id"],
147149
duration_in_minutes=slot_key["duration_in_minutes"],
148150
starts_at=starts_at,
151+
starts_at_time=starts_at_time,
149152
)
150153

151154
if "appointment" in slot_key:

0 commit comments

Comments
 (0)