MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / countFitsWithShip

Function countFitsWithShip

eos/db/saveddata/queries.py:293–318  ·  view source on GitHub ↗

Get all the fits using a certain ship. If no user is passed, do this for all users.

(lookfor, ownerID=None, where=None, eager=None)

Source from the content-addressed store, hash-verified

291
292
293def countFitsWithShip(lookfor, ownerID=None, where=None, eager=None):
294 """
295 Get all the fits using a certain ship.
296 If no user is passed, do this for all users.
297 """
298 if ownerID is not None and not isinstance(ownerID, int):
299 raise TypeError("OwnerID must be integer")
300
301 if isinstance(lookfor, int):
302 filter = Fit.shipID == lookfor
303 elif isinstance(lookfor, list):
304 if len(lookfor) == 0:
305 return 0
306 filter = Fit.shipID.in_(lookfor)
307 else:
308 raise TypeError("You must supply either an integer or ShipID must be integer")
309
310 if ownerID is not None:
311 filter = and_(filter, Fit.ownerID == ownerID)
312
313 filter = processWhere(filter, where)
314 eager = processEager(eager)
315 with sd_lock:
316 count = saveddata_session.query(Fit).options(*eager).filter(filter).count()
317
318 return count
319
320
321def getFitList(eager=None):

Callers

nothing calls this directly

Calls 2

processWhereFunction · 0.90
processEagerFunction · 0.90

Tested by

no test coverage detected