Book Feedback (#190)

* Remove automatic retry for scanLibraries as if something fails, it wont pass magically. Catch exceptions when opening books for parsing and swallow to ignore the file.

* Delete extra attempts

* Switched to using FirstOrDefault for finding existing series. This will help avoid pointless crashes.

* Updated message when duplicate series are found (not sure how this happens)

* Fixed a negation for deleting volumes where files still exist.

* Implemented the ability to automatically scale the manga reader based on screen size.

* Default to automatic scaling

* Fix an issue where malformed epubs wouldn't be readable due to incorrect keys in the OPF. We now check if key is valid and if not, try to correct it. This makes a page load about a second on malformed books.

* Fixed #176. Refactored the recently added query to be restricted to user's access to libraries.

* Fixed a one off bug with In Progress series

* Implemented the ability to refresh metadata of just a single series directly

* Fixed a parser case where Series c000 (v01) would fail to parse the series

* Fixed #189. In Progress now returns data properly for library access and in multiple libraries.

* Fixed #188 by adding an extra message for bad login and updating UI

* Generate a fallback for table of contents by parsing the toc file (if we can find one)
This commit is contained in:
Joseph Milazzo 2021-05-02 10:00:47 -05:00 committed by GitHub
parent 6d74215262
commit e2e755145c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 83 additions and 13 deletions

View file

@ -332,26 +332,45 @@ namespace API.Data
/// <returns></returns>
public async Task<IEnumerable<SeriesDto>> GetInProgress(int userId, int libraryId, int limit)
{
var series = await _context.Series
var series = _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,
LastModified = _context.AppUserProgresses.Where(p => p.Id == progress.Id).Max(p => p.LastModified)
})
.Where(s => s.AppUserId == userId
});
if (libraryId == 0)
{
var userLibraries = _context.Library
.Include(l => l.AppUsers)
.Where(library => library.AppUsers.Any(user => user.Id == userId))
.AsNoTracking()
.Select(library => library.Id)
.ToList();
series = series.Where(s => s.AppUserId == userId
&& s.PagesRead > 0
&& s.PagesRead <
s.Series.Pages -
1 // - 1 because when reading, we start at 0 then go to pages - 1. But when summing, pages assumes starting at 1
&& userLibraries.Contains(s.Series.LibraryId));
}
else
{
series = series.Where(s => s.AppUserId == userId
&& s.PagesRead > 0
&& s.PagesRead < (s.Series.Pages - 1) // - 1 because when reading, we start at 0 then go to pages - 1. But when summing, pages assumes starting at 1
&& (libraryId <= 0 || s.Series.LibraryId == libraryId))
.Take(limit)
&& s.PagesRead <
(s.Series.Pages - 1) // - 1 because when reading, we start at 0 then go to pages - 1. But when summing, pages assumes starting at 1
&& (s.Series.LibraryId == libraryId));
}
var retSeries = await series.Take(limit)
.OrderByDescending(s => s.LastModified)
.Select(s => s.Series)
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
.AsNoTracking()
.ToListAsync();
return series.DistinctBy(s => s.Name);
return retSeries.DistinctBy(s => s.Name);
}
}
}