Cover generation issue on first scan flow (#517)

* Cover generation issue on first scan flow

- Fixed logic around whether a chapter cover image should be generated. New logic adds grouping priority, changes an AND to an OR and adds an additional check to see if the cover image has been lock (custom image uploaded)

* Sonar update

* Refactored out the cover image updating logic to a new call (ShouldUpdateCoverImage) and updated ONLY chapters. Added a blank slate unit test to build out conditions.

* Fixed up unit case

* Fixed some logic on when to update a cover image

* Fixed an issue where 1) we were refreshing metadata anytime we adjusted cover image on a series and 2) Cover generation wasn't properly being handled on first run.

* Cleaned up the code for when a cover image change needs to trigger a refresh metadata task

Co-authored-by: Joseph Milazzo <joseph.v.milazzo@gmail.com>
This commit is contained in:
Robbie Davis 2021-08-22 14:32:38 -04:00 committed by GitHub
parent 7c6b12307b
commit a601942ec5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 147 additions and 22 deletions

View file

@ -155,13 +155,14 @@ namespace API.Controllers
series.Name = updateSeries.Name.Trim();
series.LocalizedName = updateSeries.LocalizedName.Trim();
series.SortName = updateSeries.SortName?.Trim();
series.Summary = updateSeries.Summary?.Trim(); // BUG: There was an exceptionSystem.NullReferenceException: Object reference not set to an instance of an object.
series.Summary = updateSeries.Summary?.Trim();
var needsRefreshMetadata = false;
if (!updateSeries.CoverImageLocked)
if (series.CoverImageLocked && !updateSeries.CoverImageLocked)
{
series.CoverImageLocked = false;
// Trigger a refresh when we are moving from a locked image to a non-locked
needsRefreshMetadata = true;
series.CoverImageLocked = updateSeries.CoverImageLocked;
}
_unitOfWork.SeriesRepository.Update(series);