Fixes all lowercase issue (#3302)

This commit is contained in:
Joe Milazzo 2024-10-24 05:36:34 -07:00 committed by GitHub
parent 184c766fa7
commit b65b78a736
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 377 additions and 65 deletions

View file

@ -72,7 +72,6 @@ public static class GenreHelper
public static void UpdateGenreList(ICollection<GenreTagDto>? existingGenres, Series series,
IReadOnlyCollection<Genre> newGenres, Action<Genre> handleAdd, Action onModified)
{
// TODO: Write some unit tests
if (existingGenres == null) return;
var isModified = false;
@ -100,18 +99,17 @@ public static class GenreHelper
{
var normalizedTitle = tagDto.Title.ToNormalized();
if (!genreSet.Contains(normalizedTitle)) // This prevents re-adding existing genres
if (genreSet.Contains(normalizedTitle)) continue; // This prevents re-adding existing genres
if (allTagsDict.TryGetValue(normalizedTitle, out var existingTag))
{
if (allTagsDict.TryGetValue(normalizedTitle, out var existingTag))
{
handleAdd(existingTag); // Add existing tag from allTagsDict
}
else
{
handleAdd(new GenreBuilder(tagDto.Title).Build()); // Add new genre if not found
}
isModified = true;
handleAdd(existingTag); // Add existing tag from allTagsDict
}
else
{
handleAdd(new GenreBuilder(tagDto.Title).Build()); // Add new genre if not found
}
isModified = true;
}
// Call onModified if any changes were made