You may want to rethink your models a bit. Here's what I envision as a basis for your app:
A Period
is a fixed object with properties start_time
, and end_time
.
This allows for some flexibility with planning a Period
- e.g. on Wednesdays, you only have periods 1, 3, 5, and 7 (but they are two hours long); same goes for periods 2, 4, 6, and 8 on Thursdays.
The id
property is 1-N because of the above flexibility: "period 3" might have two entries:
id | start_time | end_time |
---|---|---|
1 | 11:00 | 12:00 |
2 | 10:00 | 12:00 |
A Schedule
should have the properties day_of_week
and subjects_to_periods
(a dictionary
of subjects to periods).
A Teacher
has properties like first_name
, last_name
, email_address
, teachable_subjects
, and schedules
.
This is of course a contrived example, and some things may not to relevant to you at all. Hopefully, though, this helps you as you think about how you want to architect your application.