Skip to content

Commit 9388df6

Browse files
Merge pull request #104 from PyconUK/issue-89
Remove all use of strings for Slot.starts_at
2 parents 7eae828 + 6d7a45c commit 9388df6

File tree

5 files changed

+184
-179
lines changed

5 files changed

+184
-179
lines changed

docs/howto/obtain_mathematical_representation.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ When scheduling a conference, it might be desirable to recover the schedule in a
55
different format.
66
Let us schedule a simple conference as described in :ref:`tutorial`::
77

8+
>>> from datetime import datetime
89
>>> from conference_scheduler.resources import Slot, Event
910
>>> from conference_scheduler import scheduler, converter
1011

11-
>>> slots = [Slot(venue='Big', starts_at='15-Sep-2016 09:30', duration=30, session="A", capacity=200),
12-
... Slot(venue='Big', starts_at='15-Sep-2016 10:00', duration=30, session="A", capacity=200)]
12+
>>> slots = [Slot(venue='Big', starts_at=datetime(2016, 9, 15, 9, 30), duration=30, session="A", capacity=200),
13+
... Slot(venue='Big', starts_at=datetime(2016, 9, 15, 10, 0), duration=30, session="A", capacity=200)]
1314
>>> events = [Event(name='Talk 1', duration=30, demand=50),
1415
... Event(name='Talk 2', duration=30, demand=130)]
1516

@@ -19,8 +20,8 @@ We can view this schedule as before::
1920

2021
>>> for item in schedule:
2122
... print(f"{item.event.name} at {item.slot.starts_at} in {item.slot.venue}")
22-
Talk 1 at 15-Sep-2016 09:30 in Big
23-
Talk 2 at 15-Sep-2016 10:00 in Big
23+
Talk 1 at 2016-09-15 09:30:00 in Big
24+
Talk 2 at 2016-09-15 10:00:00 in Big
2425

2526
If we want to recover the mathematical array form of our solution (as described
2627
in :ref:`mathematical-model`), we use the :code:`scheduler.schedule_to_array`
@@ -36,5 +37,5 @@ We can also return from a mathematical array to the schedule using the
3637

3738
>>> for item in converter.array_to_schedule(array, events=events, slots=slots):
3839
... print(f"{item.event.name} at {item.slot.starts_at} in {item.slot.venue}")
39-
Talk 1 at 15-Sep-2016 09:30 in Big
40-
Talk 2 at 15-Sep-2016 10:00 in Big
40+
Talk 1 at 2016-09-15 09:30:00 in Big
41+
Talk 2 at 2016-09-15 10:00:00 in Big

0 commit comments

Comments
 (0)