Fixed the courseSegmentInstance sorting bug and added reasoning for sorting in the first place
This commit is contained in:
parent
c0fe9a8cb1
commit
deeb55b73f
@ -97,9 +97,13 @@ class Daisy:
|
||||
# This should be replaced by an API lookup
|
||||
booking['educationalType'] = eduTypes[booking['educationalType']]
|
||||
|
||||
# If a lecture belongs to more than one course, there will be one
|
||||
# booking for each course, all with identical times.
|
||||
# Sorting on courseSegmentInstance ensures that we return a consistent
|
||||
# course in such cases.
|
||||
def booking_sort(booking):
|
||||
if booking['courseSegmentInstances']:
|
||||
return booking['courseSegmentInstances'][0]['id']
|
||||
return booking['courseSegmentInstances'][0]['designation']
|
||||
return ''
|
||||
|
||||
Fit = namedtuple('Fit', ['booking', 'overlap'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user