aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2021-06-24 20:45:10 +0000
committerzsloan2021-06-24 20:45:10 +0000
commit8eb59689a7441c6efaeb6f2f2b2266b50864b6be (patch)
tree86b034bfca474a55bbba6f236e5577e6f0d539de
parentdfc271b685ec0bf34734890857269ccd07886688 (diff)
downloadgenenetwork2-8eb59689a7441c6efaeb6f2f2b2266b50864b6be.tar.gz
When getting maximum column widths, account for the way the Authors field limits the number of displayed Authors to 6
-rw-r--r--wqflask/wqflask/search_results.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index 3095708d..031a87b3 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -171,7 +171,11 @@ class SearchResultPage:
self.max_widths = {}
for i, trait in enumerate(trait_list):
for key in trait.keys():
- self.max_widths[key] = max(len(str(trait[key])), self.max_widths[key]) if key in self.max_widths else len(str(trait[key]))
+ if key == "authors":
+ authors_string = ",".join(str(trait[key]).split(",")[:6]) + ", et al."
+ self.max_widths[key] = max(len(authors_string), self.max_widths[key]) if key in self.max_widths else len(str(trait[key]))
+ else:
+ self.max_widths[key] = max(len(str(trait[key])), self.max_widths[key]) if key in self.max_widths else len(str(trait[key]))
self.wide_columns_exist = False
if this_trait.dataset.type == "Publish":