From 2557e75a2fe6b1c252eb976427ef6569990012ba Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sat, 20 Oct 2018 13:33:13 -0500 Subject: [PATCH] Limited how many shops can appear in ?selling --- geoffrey/DatabaseInterface.py | 2 +- geoffrey/DatabaseModels.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/geoffrey/DatabaseInterface.py b/geoffrey/DatabaseInterface.py index 4e3321d..ff248ab 100644 --- a/geoffrey/DatabaseInterface.py +++ b/geoffrey/DatabaseInterface.py @@ -134,7 +134,7 @@ class DatabaseInterface: def find_top_shops_selling_item(self, session, item_name): expr = ItemListing.name.ilike('%{}%'.format(item_name)) result = session.query(func.min(ItemListing.normalized_price), ItemListing.shop_id).group_by( - ItemListing.shop_id).filter(expr).order_by(func.min(ItemListing.normalized_price)).all() + ItemListing.shop_id).filter(expr).order_by(func.min(ItemListing.normalized_price)).limit(5).all() shop_list = [] diff --git a/geoffrey/DatabaseModels.py b/geoffrey/DatabaseModels.py index cf03bb9..ed0b537 100644 --- a/geoffrey/DatabaseModels.py +++ b/geoffrey/DatabaseModels.py @@ -253,7 +253,7 @@ class Shop(Location): } def inv_to_str(self): - if len(self.inventory.limit(25).all()) != 0: + if len(self.inventory.limit(15).all()) != 0: inv = '\n**Inventory**:' str_format = '{}\n{}'