Skip to content

Commit

Permalink
v0.8.4.2 - Hotfix (#3422)
Browse files Browse the repository at this point in the history
  • Loading branch information
majora2007 authored Nov 27, 2024
1 parent 19b0163 commit 85d0d1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions API/Controllers/ChapterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public async Task<ActionResult<bool>> DeleteChapter(int chapterId)
/// Deletes multiple chapters and any volumes with no leftover chapters
/// </summary>
/// <param name="seriesId">The ID of the series</param>
/// <param name="chapterIds">The IDs of the chapters to be deleted</param>
/// <param name="dto">The IDs of the chapters to be deleted</param>
/// <returns></returns>
[Authorize(Policy = "RequireAdminRole")]
[HttpPost("delete-multiple")]
Expand Down Expand Up @@ -255,103 +255,103 @@ public async Task<ActionResult> 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
);

// 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
);

// 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
);

// 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
);

// 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
);

// 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
);

// 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
);

// 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
);

// 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
);

// 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
);

// 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
);

// 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
);

// 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
);
Expand Down
2 changes: 1 addition & 1 deletion API/Services/SeriesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Person>();
Expand Down

0 comments on commit 85d0d1f

Please sign in to comment.