mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Fix bad ratings objects in Migration 206
This commit is contained in:
parent
d571c7b75a
commit
100fd95dd9
@ -18,7 +18,7 @@ public multiple_ratings_support()
|
|||||||
_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 @@ private void FixRatings(IDbConnection conn, IDbTransaction tran, string table)
|
|||||||
|
|
||||||
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…
Reference in New Issue
Block a user