From 505df586d5af0a66495741e82105a790bb772506 Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Wed, 27 Nov 2024 13:04:13 -0600 Subject: [PATCH 1/2] Fixed a bug with updating chapter people where the normalized name was saved. Added extra distinct to potentially fix series-level metadata update issue. --- API/Controllers/ChapterController.cs | 28 ++++++++++++++-------------- API/Services/SeriesService.cs | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/API/Controllers/ChapterController.cs b/API/Controllers/ChapterController.cs index 9f2fc4c465..5bd2390865 100644 --- a/API/Controllers/ChapterController.cs +++ b/API/Controllers/ChapterController.cs @@ -92,7 +92,7 @@ public async Task> DeleteChapter(int chapterId) /// Deletes multiple chapters and any volumes with no leftover chapters /// /// The ID of the series - /// The IDs of the chapters to be deleted + /// The IDs of the chapters to be deleted /// [Authorize(Policy = "RequireAdminRole")] [HttpPost("delete-multiple")] @@ -255,7 +255,7 @@ public async Task UpdateChapterMetadata(UpdateChapterDto dto) // Update writers await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Writers.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Writers.Select(p => p.Name).ToList(), PersonRole.Writer, _unitOfWork ); @@ -263,7 +263,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update characters await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Characters.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Characters.Select(p => p.Name).ToList(), PersonRole.Character, _unitOfWork ); @@ -271,7 +271,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update pencillers await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Pencillers.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Pencillers.Select(p => p.Name).ToList(), PersonRole.Penciller, _unitOfWork ); @@ -279,7 +279,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update inkers await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Inkers.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Inkers.Select(p => p.Name).ToList(), PersonRole.Inker, _unitOfWork ); @@ -287,7 +287,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update colorists await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Colorists.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Colorists.Select(p => p.Name).ToList(), PersonRole.Colorist, _unitOfWork ); @@ -295,7 +295,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update letterers await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Letterers.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Letterers.Select(p => p.Name).ToList(), PersonRole.Letterer, _unitOfWork ); @@ -303,7 +303,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update cover artists await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.CoverArtists.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.CoverArtists.Select(p => p.Name).ToList(), PersonRole.CoverArtist, _unitOfWork ); @@ -311,7 +311,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update editors await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Editors.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Editors.Select(p => p.Name).ToList(), PersonRole.Editor, _unitOfWork ); @@ -319,7 +319,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update publishers await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Publishers.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Publishers.Select(p => p.Name).ToList(), PersonRole.Publisher, _unitOfWork ); @@ -327,7 +327,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update translators await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Translators.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Translators.Select(p => p.Name).ToList(), PersonRole.Translator, _unitOfWork ); @@ -335,7 +335,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update imprints await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Imprints.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Imprints.Select(p => p.Name).ToList(), PersonRole.Imprint, _unitOfWork ); @@ -343,7 +343,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update teams await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Teams.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Teams.Select(p => p.Name).ToList(), PersonRole.Team, _unitOfWork ); @@ -351,7 +351,7 @@ await PersonHelper.UpdateChapterPeopleAsync( // Update locations await PersonHelper.UpdateChapterPeopleAsync( chapter, - dto.Locations.Select(p => Parser.Normalize(p.Name)).ToList(), + dto.Locations.Select(p => p.Name).ToList(), PersonRole.Location, _unitOfWork ); diff --git a/API/Services/SeriesService.cs b/API/Services/SeriesService.cs index 119baaf941..7d4a4b95ad 100644 --- a/API/Services/SeriesService.cs +++ b/API/Services/SeriesService.cs @@ -343,7 +343,7 @@ private async Task HandlePeopleUpdateAsync(SeriesMetadata metadata, ICollection< var existingPeople = await _unitOfWork.PersonRepository.GetPeopleByNames(normalizedNames); // Use a dictionary for quick lookups - var existingPeopleDictionary = existingPeople.ToDictionary(p => p.NormalizedName, p => p); + var existingPeopleDictionary = existingPeople.DistinctBy(p => p.NormalizedName).ToDictionary(p => p.NormalizedName, p => p); // List to track people that will be added to the metadata var peopleToAdd = new List(); From bdafd00f22ff5f0dadc19a42d9d4d48b050db3ea Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Wed, 27 Nov 2024 13:05:26 -0600 Subject: [PATCH 2/2] Version bump --- Kavita.Common/Kavita.Common.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kavita.Common/Kavita.Common.csproj b/Kavita.Common/Kavita.Common.csproj index a0081e81a4..6f1968428f 100644 --- a/Kavita.Common/Kavita.Common.csproj +++ b/Kavita.Common/Kavita.Common.csproj @@ -3,7 +3,7 @@ net8.0 kavitareader.com Kavita - 0.8.4.0 + 0.8.4.1 en true