From 8eb59689a7441c6efaeb6f2f2b2266b50864b6be Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 24 Jun 2021 20:45:10 +0000 Subject: When getting maximum column widths, account for the way the Authors field limits the number of displayed Authors to 6 --- wqflask/wqflask/search_results.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'wqflask') 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": -- cgit v1.2.3