Round community rating to single decimal place (#18)

This commit is contained in:
Pijus Kamandulis 2022-05-28 20:30:46 +03:00 committed by GitHub
parent 97ea3eef7f
commit db2fcd1d46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,7 @@ namespace Jellyfin.Plugin.Anime.Providers.KitsuIO.Metadata
// KitsuIO has a max rating of 100
CommunityRating = string.IsNullOrWhiteSpace(seriesInfo.Data.Attributes.AverageRating)
? null
: (float?) float.Parse(seriesInfo.Data.Attributes.AverageRating, System.Globalization.CultureInfo.InvariantCulture) / 10,
: MathF.Round(float.Parse(seriesInfo.Data.Attributes.AverageRating, System.Globalization.CultureInfo.InvariantCulture) / 10, 1),
ProviderIds = new Dictionary<string, string>() {{"Kitsu", kitsuId}},
Genres = seriesInfo.Included?.Select(x => x.Attributes.Name).ToArray()
?? Array.Empty<string>()