add some docstrings

This commit is contained in:
pablodip 2018-01-31 16:06:01 +01:00
parent 35ad4e48d0
commit eef57a3046
1 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,9 @@
(bounty-filter-type-date-options-def option)) (bounty-filter-type-date-options-def option))
(def bounty-filter-type-date-pre-predicate-value-processor (def bounty-filter-type-date-pre-predicate-value-processor
"It converts an option of the filter type date to a cljs-time interval in which
that option is valid, so that you can check `cljs-time.core.within?` against that
interval and know if a `cljs-time` date is valid for that filter type date option."
(fn [filter-value] (fn [filter-value]
(let [filter-from (condp = filter-value (let [filter-from (condp = filter-value
::bounty-filter-type-date-option|last-week (t/minus (t/now) (t/weeks 1)) ::bounty-filter-type-date-option|last-week (t/minus (t/now) (t/weeks 1))
@ -137,6 +140,11 @@
(str filter-type " with val " filter-value))) (str filter-type " with val " filter-value)))
(defn- bounty-filter-values-by-type->predicates [filters-by-type] (defn- bounty-filter-values-by-type->predicates [filters-by-type]
"It receives a map with filter types as keys and filter values as values and
returns a lazy seq of predicates, one for each pair of filter type and value.
Those predicate can receive a bounty and tell whether that bounty passes
the filter type with that filter value. It removes filter types with a `nil`
filter value."
(->> filters-by-type (->> filters-by-type
; used `nil?` because a valid filter value can be `false` ; used `nil?` because a valid filter value can be `false`
(remove #(nil? (val %))) (remove #(nil? (val %)))