Created
September 17, 2013 12:55
-
-
Save cgreening/6593953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetchRequest.entity = [RNPFeedListEntry entityInManagedObjectContext:self.managedObjectContext]; | |
// this is the main predicate to get the feed entries that belong to the us | |
NSPredicate *ownerPredicate = [NSPredicate predicateWithFormat:@"%K == %@ AND %K.%K == %@", | |
RNPFeedListEntryRelationships.owner, self, RNPFeedListEntryRelationships.feed, | |
RNPFeedAttributes.action, @(FeedAction_LIKE), self]; | |
// this is the predicate to check that we have the required item | |
NSPredicate *itemPopulatedPredicate = [NSPredicate predicateWithFormat:@"(%K.%K != nil AND %K.%K != nil) OR (%K.%K == nil)", | |
RNPFeedListEntryRelationships.feed, RNPFeedAttributes.itemId, | |
RNPFeedListEntryRelationships.feed, RNPFeedRelationships.item, | |
RNPFeedListEntryRelationships.feed, RNPFeedAttributes.itemId]; | |
fetchRequest.predicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[ownerPredicate, itemPopulatedPredicate]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment