mirror of
https://github.com/Radarr/Radarr
synced 2025-02-22 14:21:14 +00:00
Fixed: Fix bad ratings objects in Migration 206
This commit is contained in:
parent
d571c7b75a
commit
100fd95dd9
1 changed files with 11 additions and 5 deletions
|
@ -18,7 +18,7 @@ public multiple_ratings_support()
|
|||
_serializerSettings = new JsonSerializerOptions
|
||||
{
|
||||
AllowTrailingCommas = true,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
|
@ -43,18 +43,24 @@ private void FixRatings(IDbConnection conn, IDbTransaction tran, string table)
|
|||
|
||||
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…
Reference in a new issue