Fix color less than or equal to
This commit is contained in:
parent
37f2d37213
commit
1e635a4e63
1 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
import datetime
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
import typing
|
import typing
|
||||||
import uuid
|
import uuid
|
||||||
|
@ -123,7 +124,14 @@ async def advanced_search(
|
||||||
constraints.append(f"cards.color_identity ILIKE %({param})s")
|
constraints.append(f"cards.color_identity ILIKE %({param})s")
|
||||||
params[param] = tutor.models.Color.to_string(criterion.colors)
|
params[param] = tutor.models.Color.to_string(criterion.colors)
|
||||||
if criterion.operator == tutor.search.Operator.lte:
|
if criterion.operator == tutor.search.Operator.lte:
|
||||||
colors = list({str(color) for color in criterion.colors} | {""})
|
colors = list(
|
||||||
|
{
|
||||||
|
tutor.models.Color.to_string(list(combo))
|
||||||
|
for n in range(len(criterion.colors))
|
||||||
|
for combo in itertools.combinations(criterion.colors, n + 1)
|
||||||
|
}
|
||||||
|
| {""}
|
||||||
|
)
|
||||||
constraints.append(
|
constraints.append(
|
||||||
"({})".format(
|
"({})".format(
|
||||||
" OR ".join(
|
" OR ".join(
|
||||||
|
|
Loading…
Reference in a new issue