Fixed: Fix bad ratings objects in Migration 206

pull/6900/head
Qstick 3 years ago
parent d571c7b75a
commit 100fd95dd9

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Datastore.Migration
_serializerSettings = new JsonSerializerOptions
{
AllowTrailingCommas = true,
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
PropertyNameCaseInsensitive = true,
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
@ -43,18 +43,24 @@ namespace NzbDrone.Core.Datastore.Migration
foreach (var row in rows)
{
var oldRatings = JsonSerializer.Deserialize<Ratings205>(row.Ratings, _serializerSettings);
var newRatings = new Ratings206
{
Tmdb = new RatingChild206
{
Votes = oldRatings.Votes,
Value = oldRatings.Value,
Votes = 0,
Value = 0,
Type = RatingType206.User
}
};
if (row.Ratings != null)
{
var oldRatings = JsonSerializer.Deserialize<Ratings205>(row.Ratings, _serializerSettings);
newRatings.Tmdb.Votes = oldRatings.Votes;
newRatings.Tmdb.Value = oldRatings.Value;
}
corrected.Add(new Movie206
{
Id = row.Id,

Loading…
Cancel
Save