From 930d9bbd8cf28bed04e59a80443e038dcfd3cf2a Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sat, 22 Sep 2018 09:48:33 -0500 Subject: [PATCH] ?selling now also gives the shop location and can show 25 entries. --- geoffrey/DatabaseInterface.py | 5 +++-- geoffrey/DatabaseModels.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/geoffrey/DatabaseInterface.py b/geoffrey/DatabaseInterface.py index 51db217..1fc0bbc 100644 --- a/geoffrey/DatabaseInterface.py +++ b/geoffrey/DatabaseInterface.py @@ -98,9 +98,10 @@ class DatabaseInterface: expr = Tunnel.owner.has(Player.name.ilike('%{}%'.format(owner_name))) return self.database.query_by_filter(session, Tunnel, expr) - def find_item(self, session, item_name): + def find_item(self, session, item_name, limit=25): expr = ItemListing.name.ilike('%{}%'.format(item_name)) - return self.database.query_by_filter(session, ItemListing, expr, sort=ItemListing.normalized_price) + return self.database.query_by_filter(session, ItemListing, expr, limit=limit, + sort=ItemListing.normalized_price) def find_shop_selling_item(self, session, item_name): return self.find_item(session, item_name) diff --git a/geoffrey/DatabaseModels.py b/geoffrey/DatabaseModels.py index 5308d04..7f51a7c 100644 --- a/geoffrey/DatabaseModels.py +++ b/geoffrey/DatabaseModels.py @@ -215,7 +215,7 @@ class Location(SQL_Base): format(bot_config.dynmap_url, bot_config.world_name, self.x, self.z) def pos_to_str(self): - pos_str = '**(x= {}, z= {})** {}'.format(self.x, self.z, self.dimension.value.title()) + pos_str = '**(x= {}, z= {})**'.format(self.x, self.z) if self.tunnel is not None: return pos_str + ', Tunnel: **{}**'.format(self.tunnel) else: @@ -303,4 +303,4 @@ class ItemListing(SQL_Base): return '**{}** **{}** for **{}D**'.format(self.amount, self.name, self.price) def __str__(self): - return '**{}**, selling {}'.format(self.shop.name, self.listing_str()) + return '**{}** @ {}, selling {}'.format(self.shop.name, self.shop.pos_to_str(), self.listing_str())