mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-06-05 14:25:17 -04:00
A few bug fixes (#3980)
This commit is contained in:
@@ -1806,10 +1806,15 @@ public class ExternalMetadataService : IExternalMetadataService
|
||||
{
|
||||
// Find highest age rating from mappings
|
||||
mappings ??= new Dictionary<string, AgeRating>();
|
||||
mappings = mappings.ToDictionary(k => k.Key.ToNormalized(), k => k.Value);
|
||||
mappings = mappings
|
||||
.GroupBy(m => m.Key.ToNormalized())
|
||||
.ToDictionary(
|
||||
g => g.Key,
|
||||
g => g.Max(m => m.Value)
|
||||
);
|
||||
|
||||
return values
|
||||
.Select(v => mappings.TryGetValue(v.ToNormalized(), out var mapping) ? mapping : AgeRating.Unknown)
|
||||
.Select(v => mappings.GetValueOrDefault(v.ToNormalized(), AgeRating.Unknown))
|
||||
.DefaultIfEmpty(AgeRating.Unknown)
|
||||
.Max();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user