From c385d81f43e903f06d75c2293d7d89c68212ddf0 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 16 Oct 2011 22:52:02 +0400 Subject: [PATCH] Add small optimization to market service It won't fetch parent for items which are already known as parent --- service/market.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/service/market.py b/service/market.py index b84472f24..ae545c50b 100644 --- a/service/market.py +++ b/service/market.py @@ -442,10 +442,13 @@ class Market(): parent = None return parent - def getVariationsByItem(self, item): + def getVariationsByItem(self, item, alreadyparent=False): """Get item variations by item, its ID or name""" # Get parent item - parent = self.getParentItemByItem(item) + if alreadyparent is False: + parent = self.getParentItemByItem(item) + else: + parent = item # All its variations vars = set(eos.db.getVariations(parent)) # Combine both in the same set @@ -492,7 +495,7 @@ class Market(): # If item has no parent, it's base item (or at least should be) if parent is None: # Fetch variations only for parent items - variations = self.getVariationsByItem(item) + variations = self.getVariationsByItem(item, alreadyparent=True) for variation in variations: # Exclude items with their own explicitly defined market groups if self.getMarketGroupByItem(variation, parentcheck=False) is None: