Fixed a bug where the age restriction logic for a person detail page wasn't allowing the person to show if the user had access to SOME of their works.

This commit is contained in:
Joseph Milazzo 2024-12-08 10:53:46 -06:00
parent 634b165318
commit 4f13ae0f0b

View file

@ -105,8 +105,10 @@ public static class RestrictByAgeExtensions
sm.SeriesMetadata.AgeRating <= restriction.AgeRating)); sm.SeriesMetadata.AgeRating <= restriction.AgeRating));
} }
return queryable.Where(c => c.SeriesMetadataPeople.All(sm => return queryable.Where(c =>
sm.SeriesMetadata.AgeRating <= restriction.AgeRating && sm.SeriesMetadata.AgeRating > AgeRating.Unknown)); c.SeriesMetadataPeople.Any(sm => sm.SeriesMetadata.AgeRating <= restriction.AgeRating && sm.SeriesMetadata.AgeRating != AgeRating.Unknown) &&
c.ChapterPeople.Any(cp => cp.Chapter.AgeRating <= restriction.AgeRating && cp.Chapter.AgeRating != AgeRating.Unknown)
);
} }
public static IQueryable<ReadingList> RestrictAgainstAgeRestriction(this IQueryable<ReadingList> queryable, AgeRestriction restriction) public static IQueryable<ReadingList> RestrictAgainstAgeRestriction(this IQueryable<ReadingList> queryable, AgeRestriction restriction)