From 4fa7e2b1aa91a0aa74332c97ee3af78e39edf019 Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Wed, 20 Nov 2024 06:31:02 -0600 Subject: [PATCH] Can't figure out the on deck progress bug, everything up until serialization is working. Improved performance of some filtering operations to reduce memory consumption. --- API/Data/Repositories/SeriesRepository.cs | 8 +++++--- .../QueryExtensions/Filtering/SeriesFilter.cs | 10 ++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/API/Data/Repositories/SeriesRepository.cs b/API/Data/Repositories/SeriesRepository.cs index d0183ae66..cad70c3eb 100644 --- a/API/Data/Repositories/SeriesRepository.cs +++ b/API/Data/Repositories/SeriesRepository.cs @@ -696,7 +696,7 @@ public async Task> GetSeriesDtoForLibraryIdV2Async(int user var retSeries = query .ProjectTo(_mapper.ConfigurationProvider) - .AsSplitQuery() + //.AsSplitQuery() .AsNoTracking(); return await PagedList.CreateAsync(retSeries, userParams.PageNumber, userParams.PageSize); @@ -1065,9 +1065,10 @@ private async Task> CreateFilteredSearchQueryableV2(int userI query = await ApplyCollectionFilter(filter, query, userId, userRating); - query = BuildFilterQuery(userId, filter, query); + query = BuildFilterQuery(userId, filter, query); + query = query .WhereIf(userLibraries.Count > 0, s => userLibraries.Contains(s.LibraryId)) .WhereIf(onlyParentSeries, s => @@ -1078,7 +1079,8 @@ private async Task> CreateFilteredSearchQueryableV2(int userI return ApplyLimit(query .Sort(userId, filter.SortOptions) - .AsSplitQuery(), filter.LimitTo); + .AsSplitQuery() + , filter.LimitTo); } private async Task> ApplyCollectionFilter(FilterV2Dto filter, IQueryable query, int userId, AgeRestriction userRating) diff --git a/API/Extensions/QueryExtensions/Filtering/SeriesFilter.cs b/API/Extensions/QueryExtensions/Filtering/SeriesFilter.cs index 70cc97a74..822a859c5 100644 --- a/API/Extensions/QueryExtensions/Filtering/SeriesFilter.cs +++ b/API/Extensions/QueryExtensions/Filtering/SeriesFilter.cs @@ -271,14 +271,12 @@ public static IQueryable HasReadingProgress(this IQueryable quer break; case FilterComparison.GreaterThan: subQuery = subQuery.WhereGreaterThan(s => s.Percentage, readProgress); - //subQuery = subQuery.Where(s => s.Percentage > readProgress); break; case FilterComparison.GreaterThanEqual: subQuery = subQuery.WhereGreaterThanOrEqual(s => s.Percentage, readProgress); break; case FilterComparison.LessThan: subQuery = subQuery.WhereLessThan(s => s.Percentage, readProgress); - //subQuery = subQuery.Where(s => s.Percentage < readProgress); break; case FilterComparison.LessThanEqual: subQuery = subQuery.WhereLessThanOrEqual(s => s.Percentage, readProgress); @@ -302,7 +300,7 @@ public static IQueryable HasReadingProgress(this IQueryable quer throw new ArgumentOutOfRangeException(nameof(comparison), comparison, null); } - var ids = subQuery.Select(s => s.SeriesId).ToList(); + var ids = subQuery.Select(s => s.SeriesId); return queryable.Where(s => ids.Contains(s.Id)); } @@ -359,7 +357,7 @@ public static IQueryable HasAverageRating(this IQueryable querya throw new ArgumentOutOfRangeException(nameof(comparison), comparison, null); } - var ids = subQuery.Select(s => s.SeriesId).ToList(); + var ids = subQuery.Select(s => s.SeriesId); return queryable.Where(s => ids.Contains(s.Id)); } @@ -426,7 +424,7 @@ public static IQueryable HasReadLast(this IQueryable queryable, throw new ArgumentOutOfRangeException(nameof(comparison), comparison, null); } - var ids = subQuery.Select(s => s.SeriesId).ToList(); + var ids = subQuery.Select(s => s.SeriesId); return queryable.Where(s => ids.Contains(s.Id)); } @@ -487,7 +485,7 @@ public static IQueryable HasReadingDate(this IQueryable queryabl throw new ArgumentOutOfRangeException(nameof(comparison), comparison, null); } - var ids = subQuery.Select(s => s.SeriesId).ToList(); + var ids = subQuery.Select(s => s.SeriesId); return queryable.Where(s => ids.Contains(s.Id)); }