Skip to content

Commit 3587bd2

Browse files
committed
IOS-639 Remove banned books if expiration date is missing
1 parent 6085d5c commit 3587bd2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Simplified/Book/Models/NYPLBookRegistry.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,11 @@ - (void)removeExpiredBannedBooks
454454
NSMutableArray *booksToRemove = [[NSMutableArray alloc] init];
455455
for (NSString *bookIdentifer in self.identifiersToRecords) {
456456
NYPLBookRegistryRecord *record = self.identifiersToRecords[bookIdentifer];
457+
NYPLOPDSAcquisition *acquisition = record.book.defaultAcquisition;
457458
// Add the book to remove list if it is distributed by Axis360 and expired
458-
if([record.book.defaultAcquisition.type isEqualToString:ContentTypeAxis360]) {
459-
if (record.book.defaultAcquisition.availability.until &&
460-
[record.book.defaultAcquisition.availability.until compare:[NSDate date]] == NSOrderedAscending) {
459+
// or with no expiration
460+
if ([acquisition.type isEqualToString:ContentTypeAxis360]) {
461+
if ([acquisition.availability.until compare:[NSDate date]] != NSOrderedDescending) {
461462
[booksToRemove addObject:bookIdentifer];
462463
}
463464
}

0 commit comments

Comments
 (0)