Skip to content

Commit d18bc4c

Browse files
Fixed problems list not showing correct medias
1 parent 19e1c33 commit d18bc4c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Movie DB/Models/PredicateMediaLists.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ extension PredicateMediaList {
3333
NSCompoundPredicate(type: .or, subpredicates: [
3434
// We don't include movies that are marked as 'not watched'
3535
NSPredicate(
36-
format: "type = %@ AND (watchedState = nil OR watchedState != %@)",
36+
format: "type = %@ AND watchedState != %@",
3737
MediaType.movie.rawValue,
3838
MovieWatchState.notWatched.rawValue
3939
),
4040
// We don't include shows that are marked as explicitly 'not watched'
4141
NSCompoundPredicate(type: .and, subpredicates: [
4242
NSPredicate(format: "type = %@", MediaType.show.rawValue),
43-
ShowWatchState.showsNotWatchedPredicate,
43+
ShowWatchState.showsNotWatchedPredicate.negated(),
4444
]),
4545
]),
4646
// If any of these applies, information is missing

Movie DB/Utility/Extensions.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,10 @@ struct LastNameComparator: SortComparator {
120120
return lhsLastName.compare(rhsLastName)
121121
}
122122
}
123+
124+
extension NSPredicate {
125+
/// Returns a negated version of this predicate
126+
func negated() -> NSPredicate {
127+
NSCompoundPredicate(type: .not, subpredicates: [self])
128+
}
129+
}

0 commit comments

Comments
 (0)