From 2b6db04d28a2d1f6d626368a195a499ec195c9c2 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Wed, 26 Sep 2018 07:44:42 -0500 Subject: [PATCH] Added check to append "..." when a shop has more than 5 matches. --- geoffrey/Commands.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/geoffrey/Commands.py b/geoffrey/Commands.py index 0cfe7bb..55213b3 100644 --- a/geoffrey/Commands.py +++ b/geoffrey/Commands.py @@ -181,10 +181,16 @@ class Commands: if len(shop_list) == 0: raise ItemNotFound - shop_list_str = "" + shop_list_str = "\n" for shop in shop_list: - shop_list_str = shop_list_str + shop[0].selling_str() + list_to_string( - self.interface.get_inventory_matches(session, shop[0], item_name)) + '\n\n' + matches = self.interface.get_inventory_matches(session, shop[0], item_name) + shop_list_str = shop_list_str + shop[0].selling_str() + list_to_string(matches) + + if len(matches) == 5: + shop_list_str = shop_list_str + '\n**...**' + + shop_list_str = shop_list_str + '\n\n' + finally: session.close()