Skip to content

Commit 3839531

Browse files
Checkin loan license (#177)
* Onky checkin a loan with license * Match with current collection in process
1 parent 7f703c2 commit 3839531

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

api/odl2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ def run_once(self, progress: TimestampData) -> TimestampData:
348348
.filter(
349349
and_(
350350
LicensePool.open_access == False,
351+
LicensePool.collection_id == self.api.collection_id,
351352
or_(
352353
Loan.end
353354
< now
@@ -364,8 +365,11 @@ def run_once(self, progress: TimestampData) -> TimestampData:
364365
changed_pools = set()
365366
total_deleted_loans = 0
366367
for loan in expired_loans:
368+
# Only a license can be checked in
369+
if loan.license:
370+
loan.license.checkin()
367371
changed_pools.add(loan.license_pool)
368-
loan.license.checkin()
372+
self.log.info(f"Deleting loan {loan} in pool {loan.license_pool}")
369373
self._db.delete(loan)
370374
total_deleted_loans += 1
371375

0 commit comments

Comments
 (0)