pinax / symposion

a Django project for conference websites
BSD 3-Clause "New" or "Revised" License
299 stars 147 forks source link

Make timetable work with sessions that span more than one slot. #141

Open thomir opened 8 years ago

thomir commented 8 years ago

Imagine a conference with several rooms, some of which hold short talks, others hold longer tutorials. Currently, the timetable doesn't render correctly, since the rowspan calculation (symposion/schedule/timetable.py):

    @staticmethod
    def rowspan(times, start, end):
        return times.index(end) - times.index(start)

is incorrect: 'times' contains both start and end times, so this only returns the correct value of the slot being calculates does not span more than one other slot. The fix is:

    @staticmethod
    def rowspan(times, start, end):
        return max(1, (times.index(end) - times.index(start))/2)

Without this fix, the schedule renders as:

ewww

With the fix, the schedule renders correctly:

ahhhh