mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Cleanup
This commit is contained in:
parent
0a85555f38
commit
e60d84a2c8
@ -101,8 +101,8 @@ namespace API.Data
|
|||||||
public async Task<IEnumerable<InProgressChapterDto>> GetContinueReading(int userId, int libraryId, int limit)
|
public async Task<IEnumerable<InProgressChapterDto>> GetContinueReading(int userId, int libraryId, int limit)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Get Continue Reading");
|
_logger.LogInformation("Get Continue Reading");
|
||||||
var progress = await _context.Chapter
|
var chapters = await _context.Chapter
|
||||||
.Join(_context.AppUserProgresses, chapter => chapter.Id, progress => progress.ChapterId,
|
.Join(_context.AppUserProgresses, c => c.Id, p => p.ChapterId,
|
||||||
(chapter, progress) =>
|
(chapter, progress) =>
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
@ -123,7 +123,7 @@ namespace API.Data
|
|||||||
.Take(limit)
|
.Take(limit)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
return progress
|
return chapters
|
||||||
.OrderBy(c => float.Parse(c.Chapter.Number), new ChapterSortComparer())
|
.OrderBy(c => float.Parse(c.Chapter.Number), new ChapterSortComparer())
|
||||||
.DistinctBy(p => p.Series.Id)
|
.DistinctBy(p => p.Series.Id)
|
||||||
.Select(arg => new InProgressChapterDto()
|
.Select(arg => new InProgressChapterDto()
|
||||||
@ -136,48 +136,6 @@ namespace API.Data
|
|||||||
LibraryId = arg.Series.LibraryId,
|
LibraryId = arg.Series.LibraryId,
|
||||||
Pages = arg.Chapter.Pages,
|
Pages = arg.Chapter.Pages,
|
||||||
});
|
});
|
||||||
|
|
||||||
// var chapters = await _context.Chapter
|
|
||||||
// .Join(_context.AppUserProgresses, chapter => chapter.Id, progress => progress.ChapterId, (chapter, progress) =>
|
|
||||||
// new
|
|
||||||
// {
|
|
||||||
// Chapter = chapter,
|
|
||||||
// Progress = progress
|
|
||||||
// })
|
|
||||||
// .Where(arg => arg.Progress.AppUserId == userId && arg.Progress.PagesRead < arg.Chapter.Pages)
|
|
||||||
// .Join(_context.Series, arg => arg.Progress.SeriesId, series => series.Id, (arg, series) =>
|
|
||||||
// new
|
|
||||||
// {
|
|
||||||
// arg.Chapter,
|
|
||||||
// arg.Progress,
|
|
||||||
// Series = series
|
|
||||||
// })
|
|
||||||
// .AsNoTracking()
|
|
||||||
// //.OrderBy(s => s.Chapter.Number)
|
|
||||||
// .GroupBy(p => p.Series.Id)
|
|
||||||
// .Select(g => g.FirstOrDefault())
|
|
||||||
// .Select(arg => new InProgressChapterDto()
|
|
||||||
// {
|
|
||||||
// Id = arg.Chapter.Id,
|
|
||||||
// Number = arg.Chapter.Number,
|
|
||||||
// Range = arg.Chapter.Range,
|
|
||||||
// SeriesId = arg.Progress.SeriesId,
|
|
||||||
// SeriesName = arg.Series.Name,
|
|
||||||
// LibraryId = arg.Series.LibraryId,
|
|
||||||
// Pages = arg.Chapter.Pages,
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// //.OrderBy(c => float.Parse(c.Number)) //can't convert to SQL
|
|
||||||
//
|
|
||||||
// .ToListAsync();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// return chapters;
|
|
||||||
|
|
||||||
|
|
||||||
// return chapters
|
|
||||||
// .OrderBy(c => float.Parse(c.Number), new ChapterSortComparer())
|
|
||||||
// .DistinctBy(c => c.SeriesName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,8 +20,7 @@ namespace API.Helpers
|
|||||||
CreateMap<Chapter, ChapterDto>();
|
CreateMap<Chapter, ChapterDto>();
|
||||||
|
|
||||||
CreateMap<Series, SeriesDto>();
|
CreateMap<Series, SeriesDto>();
|
||||||
//CreateMap<Series, InProgressChapterDto>();
|
|
||||||
|
|
||||||
CreateMap<AppUserPreferences, UserPreferencesDto>();
|
CreateMap<AppUserPreferences, UserPreferencesDto>();
|
||||||
|
|
||||||
CreateMap<Series, SearchResultDto>()
|
CreateMap<Series, SearchResultDto>()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user