Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
C# annotationscbzcomicinfocomicscomics-readercross-platformcsharpepubepub-readerfreelinuxmangamedia-servermetadataopdsopds-feedpdfself-hostedubooquitywindows
In Progress Activity Stream Fixes (#136)
Joseph Milazzoca5c666b7b86
diff --git a/API/Data/SeriesRepository.cs b/API/Data/SeriesRepository.csindex 84b904b51..b9bae9773 100644--- a/API/Data/SeriesRepository.cs+++ b/API/Data/SeriesRepository.cs@@ -302,22 +302,27 @@ namespace API.Data/// <returns></returns>public async Task<IEnumerable<SeriesDto>> GetInProgress(int userId, int libraryId, int limit){++ var seriesWithProgress = _context.Series+ .Join(_context.AppUserProgresses, s => s.Id, progress => progress.SeriesId, (s, progress) => new+ {+ Series = s,+ PagesRead = _context.AppUserProgresses.Where(s1 => s1.SeriesId == s.Id).Sum(s1 => s1.PagesRead),+ progress.AppUserId,+ progress.LastModified+ })+ .Where(s => s.AppUserId == userId+ && s.PagesRead > 0+ && s.PagesRead < s.Series.Pages+ && (libraryId <= 0 || s.Series.LibraryId == libraryId))+ .Select(s => s.Series.Id);++var series = await _context.Series- .Join(_context.AppUserProgresses, s => s.Id, progress => progress.SeriesId, (s, progress) => new- {- Series = s,- PagesRead = _context.AppUserProgresses.Where(s1 => s1.SeriesId == s.Id).Sum(s1 => s1.PagesRead),- progress.AppUserId,- progress.LastModified- })- .Where(s => s.AppUserId == userId- && s.PagesRead > 0- && s.PagesRead < s.Series.Pages- && (libraryId <= 0 || s.Series.LibraryId == libraryId) )- .Take(limit)+ .Where(s => seriesWithProgress.Contains(s.Id)).OrderByDescending(s => s.LastModified)- .Select(s => s.Series)- .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)+ .Take(limit)+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider).AsNoTracking().ToListAsync();return series.DistinctBy(s => s.Name);