Add queries to fetch presence of fits and number of fits
This commit is contained in:
@@ -29,6 +29,7 @@ import eos.types
|
||||
|
||||
from eos.types import State, Slot
|
||||
|
||||
from service.market import Market
|
||||
from service.damagePattern import DamagePattern
|
||||
from service.character import Character
|
||||
|
||||
@@ -91,6 +92,19 @@ class Fit(object):
|
||||
|
||||
return names
|
||||
|
||||
def countFitsWithShip(self, id):
|
||||
count = eos.db.countFitsWithShip(id)
|
||||
return count
|
||||
|
||||
def groupHasFits(self, id):
|
||||
sMkt = Market.getInstance()
|
||||
grp = sMkt.getGroup(id)
|
||||
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]
|
||||
|
||||
@@ -462,6 +462,11 @@ class Market():
|
||||
children.add(child)
|
||||
return children
|
||||
|
||||
def getItemsByGroup(self, group):
|
||||
"""Get items assigned to group"""
|
||||
items = group.items
|
||||
return items
|
||||
|
||||
def getItemsByMarketGroup(self, mg, vars=True):
|
||||
"""Get items in the given market group"""
|
||||
result = set()
|
||||
|
||||
Reference in New Issue
Block a user