Fix Unit Tests

This commit is contained in:
Amelia 2025-04-26 20:29:46 +02:00
parent f29c63c6c4
commit 749fb24185
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA
7 changed files with 219 additions and 178 deletions

View file

@ -1086,6 +1086,8 @@ public class ExternalMetadataService : IExternalMetadataService
madeModification = await UpdateChapterCoverImage(chapter, settings, potentialMatch.CoverImageUrl) || madeModification;
madeModification = await UpdateChapterReviews(chapter, settings, potentialMatch) || madeModification;
_unitOfWork.ChapterRepository.Update(chapter);
await _unitOfWork.CommitAsync();
}
@ -1094,6 +1096,18 @@ public class ExternalMetadataService : IExternalMetadataService
return madeModification;
}
private async Task<bool> UpdateChapterReviews(Chapter chapter, MetadataSettingsDto settings, ExternalChapterDto metadata)
{
if (!settings.Enabled) return false;
if (metadata.UserReviews.Count == 0 && metadata.CriticReviews.Count == 0) return false;
// Clear current ratings
chapter.Ratings.Clear();
return true;
}
private static bool UpdateChapterSummary(Chapter chapter, MetadataSettingsDto settings, string? summary)
{