Skip to content

Commit

Permalink
Can't figure out the on deck progress bug, everything up until serial…
Browse files Browse the repository at this point in the history
…ization is working.

Improved performance of some filtering operations to reduce memory consumption.
  • Loading branch information
majora2007 committed Nov 20, 2024
1 parent 8821d7b commit 4fa7e2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 5 additions & 3 deletions API/Data/Repositories/SeriesRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ public async Task<PagedList<SeriesDto>> GetSeriesDtoForLibraryIdV2Async(int user

var retSeries = query
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
.AsSplitQuery()
//.AsSplitQuery()
.AsNoTracking();

return await PagedList<SeriesDto>.CreateAsync(retSeries, userParams.PageNumber, userParams.PageSize);
Expand Down Expand Up @@ -1065,9 +1065,10 @@ private async Task<IQueryable<Series>> 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 =>
Expand All @@ -1078,7 +1079,8 @@ private async Task<IQueryable<Series>> CreateFilteredSearchQueryableV2(int userI

return ApplyLimit(query
.Sort(userId, filter.SortOptions)
.AsSplitQuery(), filter.LimitTo);
.AsSplitQuery()
, filter.LimitTo);
}

private async Task<IQueryable<Series>> ApplyCollectionFilter(FilterV2Dto filter, IQueryable<Series> query, int userId, AgeRestriction userRating)
Expand Down
10 changes: 4 additions & 6 deletions API/Extensions/QueryExtensions/Filtering/SeriesFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,12 @@ public static IQueryable<Series> HasReadingProgress(this IQueryable<Series> 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);
Expand All @@ -302,7 +300,7 @@ public static IQueryable<Series> HasReadingProgress(this IQueryable<Series> 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));
}

Expand Down Expand Up @@ -359,7 +357,7 @@ public static IQueryable<Series> HasAverageRating(this IQueryable<Series> 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));
}

Expand Down Expand Up @@ -426,7 +424,7 @@ public static IQueryable<Series> HasReadLast(this IQueryable<Series> 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));
}

Expand Down Expand Up @@ -487,7 +485,7 @@ public static IQueryable<Series> HasReadingDate(this IQueryable<Series> 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));
}

Expand Down

0 comments on commit 4fa7e2b

Please sign in to comment.