summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-04-18 19:50:04 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-04-18 19:50:07 -0700
commit46c07cee6eb2161cdc35e954e207ce120340f1ea (patch)
tree35964cbe399e480515512fb5cadc6b9c8bced6a3 /python/fatcat_web
parent71ffc180036088d310714ca3d960b6378290a809 (diff)
downloadfatcat-46c07cee6eb2161cdc35e954e207ce120340f1ea.tar.gz
fatcat-46c07cee6eb2161cdc35e954e207ce120340f1ea.zip
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.
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/routes.py4
1 files changed, 3 insertions, 1 deletions
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)