Skip to content

Commit 781e4e2

Browse files
Merge pull request #1012 from NYPL-Simplified/russell/update-expiration-check
Update expiration logic for banned books
2 parents 0657a2b + 0e6346d commit 781e4e2

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • simplified-books-controller/src/main/java/org/nypl/simplified/books/controller

simplified-books-controller/src/main/java/org/nypl/simplified/books/controller/BookSyncTask.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,16 @@ class BookSyncTask(
127127
try {
128128
this.logger.debug("[{}] checking for deletion", existingId.brief())
129129
val dbEntry = bookDatabase.entry(existingId)
130-
val avail = dbEntry.book.entry.availability
131-
val endDate = avail.endDate.getOrNull() ?: continue
132130

133-
if (endDate <= DateTime.now()) {
134-
this.logger.debug("[{}] deleting", existingId.brief())
131+
// Only expire Axis books
132+
val dist = dbEntry.book.entry.distribution
133+
if (dist != "Axis 360") continue
134+
this.logger.debug("[{}] is Axis pub, checking expiration", existingId.brief())
135+
136+
val avail = dbEntry.book.entry.availability
137+
val endDate = avail.endDate.getOrNull()
138+
if (endDate == null || endDate <= DateTime.now()) {
139+
this.logger.debug("[{}] is expired, deleting", existingId.brief())
135140
bookRegistry.clearFor(existingId)
136141
dbEntry.delete()
137142
}

0 commit comments

Comments
 (0)