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

Loading…
Cancel
Save