Fixing similar parental rating calculation (#8959)
This commit is contained in:
parent
678bcf9a80
commit
ac9b7142cc
|
@ -2401,13 +2401,17 @@ namespace Emby.Server.Implementations.Data
|
|||
var builder = new StringBuilder();
|
||||
builder.Append('(');
|
||||
|
||||
if (string.IsNullOrEmpty(item.OfficialRating))
|
||||
if (item.InheritedParentalRatingValue == 0)
|
||||
{
|
||||
builder.Append("(OfficialRating is null * 10)");
|
||||
builder.Append("((InheritedParentalRatingValue=0) * 10)");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Append("(OfficialRating=@ItemOfficialRating * 10)");
|
||||
builder.Append(
|
||||
@"(SELECT CASE WHEN InheritedParentalRatingValue=0
|
||||
THEN 0
|
||||
ELSE 10.0 / (1.0 + ABS(InheritedParentalRatingValue - @InheritedParentalRatingValue))
|
||||
END)");
|
||||
}
|
||||
|
||||
if (item.ProductionYear.HasValue)
|
||||
|
@ -2521,6 +2525,11 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
statement.TryBind("@SimilarItemId", item.Id);
|
||||
}
|
||||
|
||||
if (commandText.Contains("@InheritedParentalRatingValue", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
statement.TryBind("@InheritedParentalRatingValue", item.InheritedParentalRatingValue);
|
||||
}
|
||||
}
|
||||
|
||||
private string GetJoinUserDataText(InternalItemsQuery query)
|
||||
|
|
Loading…
Reference in New Issue
Block a user