mirror of
https://github.com/Readarr/Readarr
synced 2025-12-26 18:22:32 +01:00
Fiddle release date
This commit is contained in:
parent
6bdfe01fbc
commit
d1caed5c7d
1 changed files with 14 additions and 0 deletions
|
|
@ -251,6 +251,20 @@ private static Book MapBook(WorkResource resource)
|
|||
book.Editions = new List<Edition>();
|
||||
}
|
||||
|
||||
// sometimes the work release date is after the earliest good edition release
|
||||
var editionReleases = book.Editions.Value
|
||||
.Where(x => x.ReleaseDate.HasValue && x.ReleaseDate.Value.Month != 1 && x.ReleaseDate.Value.Day != 1)
|
||||
.ToList();
|
||||
|
||||
if (editionReleases.Any())
|
||||
{
|
||||
var earliestRelease = editionReleases.Min(x => x.ReleaseDate.Value);
|
||||
if (earliestRelease < book.ReleaseDate)
|
||||
{
|
||||
book.ReleaseDate = earliestRelease;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Assert(!book.Editions.Value.Any() || book.Editions.Value.Count(x => x.Monitored) == 1, "one edition monitored");
|
||||
|
||||
book.AnyEditionOk = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue