Make sure that items with forced group do not appear in their original group

This commit is contained in:
DarkPhoenix
2011-04-26 14:57:58 +04:00
parent 45fef160ca
commit dcb4d6566a
2 changed files with 5 additions and 6 deletions

View File

@@ -98,10 +98,10 @@ class Fit(object):
def groupHasFits(self, id):
sMkt = Market.getInstance()
grp = sMkt.getGroup(id)
grp = sMkt.getGroup(id, eager=("items", "group"))
items = sMkt.getItemsByGroup(grp)
for item in items:
if self.countFitsWithShip(item.id) > 0:
if self.countFitsWithShip(item.ID) > 0:
return True
return False

View File

@@ -464,7 +464,7 @@ class Market():
def getItemsByGroup(self, group):
"""Get items assigned to group"""
items = group.items
items = set(filter(lambda item: self.getPublicityByItem(item) and item.group == group, group.items))
return items
def getItemsByMarketGroup(self, mg, vars=True):
@@ -563,9 +563,8 @@ class Market():
def getShipList(self, grpid):
"""Get ships for given group id"""
grp = self.getGroup(grpid, eager = ("items", "items.marketGroup", "items.attributes"))
ships = set(filter(lambda ship: self.getPublicityByItem(ship), grp.items))
#ships.append((item.ID, item.name, item.race))
grp = self.getGroup(grpid, eager = ("items", "items.group", "items.attributes"))
ships = self.getItemsByGroup(grp)
return ships
def getShipListDelayed(self, id, callback):