mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 03:52:33 +02:00
Fixed: SQL error searching for movie by name
This commit is contained in:
parent
32a6c9fe2a
commit
5c9b85972d
@ -169,6 +169,16 @@ public void where_in_list_2()
|
||||
_subject.ToString().Should().Be($"((\"Movies\".\"CleanTitle\" = @Clause1_P1) AND (\"Movies\".\"Id\" IN (1, 2, 3)))");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void where_in_string_list()
|
||||
{
|
||||
var list = new List<string> { "first", "second", "third" };
|
||||
|
||||
_subject = Where(x => list.Contains(x.CleanTitle));
|
||||
|
||||
_subject.ToString().Should().Be($"(\"Movies\".\"CleanTitle\" IN @Clause1_P1)");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void enum_as_int()
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ private void ParseContainsExpression(MethodCallExpression expression)
|
||||
{
|
||||
var list = expression.Object;
|
||||
|
||||
if (list != null && (list.Type == typeof(string) || list.Type == typeof(List<string>)))
|
||||
if (list != null && (list.Type == typeof(string)))
|
||||
{
|
||||
ParseStringContains(expression);
|
||||
return;
|
||||
|
@ -101,8 +101,9 @@ public bool MoviePathExists(string path)
|
||||
|
||||
public List<Movie> FindByTitles(List<string> titles)
|
||||
{
|
||||
return Query(Builder().OrWhere<Movie>(x => titles.Contains(x.CleanTitle))
|
||||
.OrWhere<AlternativeTitle>(x => titles.Contains(x.CleanTitle)));
|
||||
var distinct = titles.Distinct().ToList();
|
||||
return Query(Builder().OrWhere<Movie>(x => distinct.Contains(x.CleanTitle))
|
||||
.OrWhere<AlternativeTitle>(x => distinct.Contains(x.CleanTitle)));
|
||||
}
|
||||
|
||||
public List<Movie> FindByTitleInexact(string cleanTitle)
|
||||
|
Loading…
Reference in New Issue
Block a user