Handle counting number of fits per ship category more efficiently (see #819)
This commit is contained in:
@@ -142,19 +142,10 @@ class Fit(object):
|
||||
def countAllFits(self):
|
||||
return eos.db.countAllFits()
|
||||
|
||||
def countFitsWithShip(self, shipID):
|
||||
count = eos.db.countFitsWithShip(shipID)
|
||||
def countFitsWithShip(self, stuff):
|
||||
count = eos.db.countFitsWithShip(stuff)
|
||||
return count
|
||||
|
||||
def groupHasFits(self, groupID):
|
||||
sMkt = Market.getInstance()
|
||||
grp = sMkt.getGroup(groupID)
|
||||
items = sMkt.getItemsByGroup(grp)
|
||||
for item in items:
|
||||
if self.countFitsWithShip(item.ID) > 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
def getModule(self, fitID, pos):
|
||||
fit = eos.db.getFit(fitID)
|
||||
return fit.modules[pos]
|
||||
|
||||
@@ -543,6 +543,7 @@ class Market():
|
||||
def getGroupsByCategory(self, cat):
|
||||
"""Get groups from given category"""
|
||||
groups = set(filter(lambda grp: self.getPublicityByGroup(grp), cat.groups))
|
||||
|
||||
return groups
|
||||
|
||||
def getMarketGroupChildren(self, mg):
|
||||
|
||||
Reference in New Issue
Block a user