Feature/bugfix and regex (#174)
* Fixed #172 * Fixes #164 * Added a parse test for [Hidoi]_Amaenaideyo_MS_vol01_chp02.rar * Fix annoying warning about SplitQuery on GetLibraryDtosForUsernameAsync
This commit is contained in:
parent
d59d60d9ec
commit
09a953be8c
4 changed files with 43 additions and 21 deletions
|
@ -41,6 +41,7 @@ namespace API.Data
|
|||
.OrderBy(l => l.Name)
|
||||
.ProjectTo<LibraryDto>(_mapper.ConfigurationProvider)
|
||||
.AsNoTracking()
|
||||
.AsSingleQuery()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
|
|
@ -315,14 +315,13 @@ namespace API.Data
|
|||
/// <returns></returns>
|
||||
public async Task<IEnumerable<SeriesDto>> GetInProgress(int userId, int libraryId, int limit)
|
||||
{
|
||||
|
||||
var seriesWithProgress = _context.Series
|
||||
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
|
||||
LastModified = _context.AppUserProgresses.Where(p => p.Id == progress.Id).Max(p => p.LastModified)
|
||||
})
|
||||
.Where(s => s.AppUserId == userId
|
||||
&& s.PagesRead > 0
|
||||
|
@ -330,14 +329,11 @@ namespace API.Data
|
|||
&& (libraryId <= 0 || s.Series.LibraryId == libraryId))
|
||||
.OrderByDescending(s => s.LastModified)
|
||||
.Take(limit)
|
||||
.Select(s => s.Series.Id);
|
||||
|
||||
|
||||
var series = await _context.Series
|
||||
.Where(s => seriesWithProgress.Contains(s.Id))
|
||||
.Select(s => s.Series)
|
||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
return series.DistinctBy(s => s.Name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue