From 46c07cee6eb2161cdc35e954e207ce120340f1ea Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 18 Apr 2019 19:50:04 -0700 Subject: fix author sort order on release view My sorting function was too clever, so I made it even more clever. Closes #27; thanks @ibnesayeed for the report. --- python/fatcat_web/routes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index f14ca5f6..633cbb22 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -292,8 +292,10 @@ def release_view(ident): # November 1. if ref.extra and ref.extra.get('unstructured'): ref.extra['unstructured'] = strip_extlink_xml(ref.extra['unstructured']) + # author list to display; ensure it's sorted by index (any othors with + # index=None go to end of list) authors = [c for c in entity.contribs if c.role in ('author', None)] - authors = sorted(authors, key=lambda c: c.index or 99999999) + authors = sorted(authors, key=lambda c: (c.index == None and 99999999) or c.index) return render_template('release_view.html', release=entity, authors=authors, container=entity.container) -- cgit v1.2.3