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 decimal
|
||||
import itertools
|
||||
import logging
|
||||
import typing
|
||||
import uuid
|
||||
|
@ -123,7 +124,14 @@ async def advanced_search(
|
|||
constraints.append(f"cards.color_identity ILIKE %({param})s")
|
||||
params[param] = tutor.models.Color.to_string(criterion.colors)
|
||||
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(
|
||||
"({})".format(
|
||||
" OR ".join(
|
||||
|
|
Loading…
Reference in a new issue