fix: stabilize sorts of upcoming meetings (#4661)

* fix: stabilize upcoming meeting sort

* fix: stabilize upcoming meeting ical sort
This commit is contained in:
Jennifer Richards 2022-10-27 15:03:14 -03:00 committed by GitHub
parent a3673f25cb
commit a5f0259072
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3467,8 +3467,12 @@ def upcoming(request):
entries = list(ietf_meetings)
entries.extend(list(interim_sessions))
entries.sort(key = lambda o: pytz.utc.localize(datetime.datetime.combine(o.date, datetime.datetime.min.time())) if isinstance(o,Meeting) else o.official_timeslotassignment().timeslot.utc_start_time())
entries.sort(
key=lambda o: (
pytz.utc.localize(datetime.datetime.combine(o.date, datetime.datetime.min.time())) if isinstance(o, Meeting) else o.official_timeslotassignment().timeslot.utc_start_time(),
o.number if isinstance(o, Meeting) else o.meeting.number,
)
)
for o in entries:
if isinstance(o, Meeting):
o.start_timestamp = int(pytz.utc.localize(datetime.datetime.combine(o.date, datetime.time.min)).timestamp())
@ -3531,7 +3535,7 @@ def upcoming_ical(request):
session__in=[s.pk for m in meetings for s in m.sessions if m.type_id != 'ietf'],
timeslot__time__gte=today,
).order_by(
'schedule__meeting__date', 'session__type', 'timeslot__time'
'schedule__meeting__date', 'session__type', 'timeslot__time', 'schedule__meeting__number',
).select_related(
'session__group', 'session__group__parent', 'timeslot', 'schedule', 'schedule__meeting'
).distinct())