Skip to content

Commit

Permalink
Fix NoAestheticScore and Unrated behavior to work only when UseAethet…
Browse files Browse the repository at this point in the history
…icScore and UserRating are true
  • Loading branch information
RupertAvery committed Aug 17, 2024
1 parent 4d3b10f commit 3a480a0
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions Diffusion.Database/QueryBuilder.Filter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,18 @@ private static void FilterAestheticScore(Filter filter, List<KeyValuePair<string
{
if (filter.UseAestheticScore)
{
var oper = filter.AestheticScoreOp;
conditions.Add(new KeyValuePair<string, object>($"(AestheticScore {oper} ?)", filter.AestheticScore));
} else if (filter.NoAestheticScore)
{
conditions.Add(new KeyValuePair<string, object>($"(AestheticScore IS NULL)", null));
if (filter.NoAestheticScore)
{
conditions.Add(new KeyValuePair<string, object>($"(AestheticScore IS NULL)", null));
}
else
{
var oper = filter.AestheticScoreOp;
if (oper is { Length: > 0 } && filter.AestheticScore.HasValue)
{
conditions.Add(new KeyValuePair<string, object>($"(AestheticScore {oper} ?)", filter.AestheticScore));
}
}
}
}

Expand All @@ -205,11 +212,18 @@ private static void FilterRating(Filter filter, List<KeyValuePair<string, object
{
if (filter.UseRating)
{
var oper = filter.RatingOp;
conditions.Add(new KeyValuePair<string, object>($"(Rating {oper} ?)", filter.Rating));
} else if (filter.Unrated)
{
conditions.Add(new KeyValuePair<string, object>($"(Rating IS NULL)", null));
if (filter.Unrated)
{
conditions.Add(new KeyValuePair<string, object>($"(Rating IS NULL)", null));
}
else
{
var oper = filter.RatingOp;
if (oper is { Length: > 0 } && filter.Rating.HasValue)
{
conditions.Add(new KeyValuePair<string, object>($"(Rating {oper} ?)", filter.Rating));
}
}
}
}

Expand Down

0 comments on commit 3a480a0

Please sign in to comment.