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)
| 291 | |
| 292 | |
| 293 | def 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 | |
| 321 | def getFitList(eager=None): |
nothing calls this directly
no test coverage detected