From 7d54923041f3bc61583965163539e5f5cee0bd84 Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Thu, 1 Apr 2021 09:18:26 -0500 Subject: [PATCH] Fixed a bug where chapter cover images weren't being updated due to a missed not. --- API/Extensions/FileInfoExtensions.cs | 4 ++-- API/Services/MetadataService.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/API/Extensions/FileInfoExtensions.cs b/API/Extensions/FileInfoExtensions.cs index d96b06de6..82f6e663f 100644 --- a/API/Extensions/FileInfoExtensions.cs +++ b/API/Extensions/FileInfoExtensions.cs @@ -10,9 +10,9 @@ namespace API.Extensions return comparison.Equals(fileInfo.LastWriteTime); } - public static bool IsLastWriteOlder(this FileInfo fileInfo, DateTime comparison) + public static bool IsLastWriteLessThan(this FileInfo fileInfo, DateTime comparison) { - return comparison > fileInfo.LastWriteTime; + return fileInfo.LastWriteTime < comparison; } } } \ No newline at end of file diff --git a/API/Services/MetadataService.cs b/API/Services/MetadataService.cs index 405e4c7e1..889bde5f9 100644 --- a/API/Services/MetadataService.cs +++ b/API/Services/MetadataService.cs @@ -33,7 +33,7 @@ namespace API.Services public void UpdateMetadata(Chapter chapter, bool forceUpdate) { var firstFile = chapter.Files.OrderBy(x => x.Chapter).FirstOrDefault(); - if (ShouldFindCoverImage(chapter.CoverImage, forceUpdate) && firstFile != null && new FileInfo(firstFile.FilePath).IsLastWriteOlder(firstFile.LastModified)) + if (ShouldFindCoverImage(chapter.CoverImage, forceUpdate) && firstFile != null && !new FileInfo(firstFile.FilePath).IsLastWriteLessThan(firstFile.LastModified)) { chapter.Files ??= new List(); chapter.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true); @@ -53,7 +53,7 @@ namespace API.Services // Skip calculating Cover Image (I/O) if the chapter already has it set if (firstChapter == null || ShouldFindCoverImage(firstChapter.CoverImage)) { - if (firstFile != null && !new FileInfo(firstFile.FilePath).IsLastWriteOlder(firstFile.LastModified)) + if (firstFile != null && !new FileInfo(firstFile.FilePath).IsLastWriteLessThan(firstFile.LastModified)) { volume.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true); }