Merge lp:~mhall119/summit/fix-multislot-scheduling into lp:summit

Proposed by Michael Hall
Status: Merged
Approved by: Chris Johnston
Approved revision: 383
Merged at revision: 382
Proposed branch: lp:~mhall119/summit/fix-multislot-scheduling
Merge into: lp:summit
Diff against target: 35 lines (+5/-3)
2 files modified
summit/schedule/fields.py (+1/-1)
summit/schedule/models/meetingmodel.py (+4/-2)
To merge this branch: bzr merge lp:~mhall119/summit/fix-multislot-scheduling
Reviewer Review Type Date Requested Status
Summit Hackers Pending
Review via email: mp+104609@code.launchpad.net

Commit message

Fix scheduling conflicts when multi-slot meetings span a break slot

Description of the change

Count the number of breaks a multi-slot meeting is crossing and subtract that from the actual distance of slots when checking availability after a multi-slot meeting

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'summit/schedule/fields.py'
2--- summit/schedule/fields.py 2012-01-23 01:18:55 +0000
3+++ summit/schedule/fields.py 2012-05-03 19:39:18 +0000
4@@ -36,7 +36,7 @@
5 def formfield(self, **kwargs):
6 defaults = {
7 'form_class': forms.RegexField,
8- 'regex': r'^[a-z][a-z0-9-]*$',
9+ 'regex': r'^[a-z][a-z0-9-\.]*$',
10 'max_length': self.max_length,
11 'error_messages': {
12 'invalid': _(
13
14=== modified file 'summit/schedule/models/meetingmodel.py'
15--- summit/schedule/models/meetingmodel.py 2012-04-18 13:00:52 +0000
16+++ summit/schedule/models/meetingmodel.py 2012-05-03 19:39:18 +0000
17@@ -409,15 +409,17 @@
18
19 # Check that the room is not in use by a double session
20 slot_num = all_slots.index(this_slot)
21+ breaks = 0
22 for i in range(slot_num, 0, -1):
23 distance = 2 + slot_num - i
24 prev_slot = all_slots[i - 1]
25 if prev_slot.type != this_slot.type:
26- break
27+ breaks += 1
28+ continue
29
30 for agenda in prev_slot.agenda_set.filter(room=room):
31 if agenda.meeting != self \
32- and agenda.meeting.slots >= distance:
33+ and agenda.meeting.slots >= (distance - breaks):
34 raise Meeting.SchedulingError("Room is in use by %s"
35 % agenda.meeting)
36

Subscribers

People subscribed via source and target branches