add converted mana cost search filtering

This commit is contained in:
Gered 2016-06-29 14:50:34 -04:00
parent 2e0644057e
commit ad413d5399
2 changed files with 2 additions and 0 deletions

View file

@ -120,6 +120,7 @@
(def search-filter-defs
{:name {:label "Name" :type :text :comparisons [:like :=]}
:set-code {:label "Set" :type :text :comparisons [:=] :component set-search-field-element}
:cmc {:label "Converted Mana Cost" :type :numeric :comparisons [:= :> :<] :validation-fn valid-integer? :transform-fn js/parseInt}
:colors {:label "Colors" :type :checkbox :comparisons [:like :=] :choices ["Black" "Blue" "Green" "Red" "White"] :component checkboxes-search-field-element}
:color-identity {:label "Color Identity" :type :checkbox :comparisons [:like :=] :choices [["Black" "B"] ["Blue" "U"] ["Green" "G"] ["Red" "R"] ["White" "W"]] :component checkboxes-search-field-element}
:type {:label "Type" :type :text :comparisons [:like :=]}

View file

@ -140,6 +140,7 @@
(def search-field-where-clauses
{:name (text-comparison-fn [:name :normalized_name])
:set-code (text-comparison-fn [:set_code] true)
:cmc (numeric-comparison-fn [:converted_mana_cost])
:colors (fn [value comparison]
(let [colors (as-> value x
(map string/trim x)