some filtering and sorting fixes

This commit is contained in:
pablodip 2018-02-01 15:56:15 +01:00
parent 34db7df1fc
commit a3e42fe61f
4 changed files with 15 additions and 7 deletions

View File

@ -84,7 +84,7 @@
(let [new-min (min current-min (max default-min new-max))]
(on-change-fn new-min new-max)))]
[:div
"$0 - $1000+"
(::ui-model/bounty-filter.type.header filter-type-def)
[bounties-filter-tooltip-value-input-view "Min" tooltip-open? (merge common-range-opts
{:current-val current-min
:on-change-val on-min-change-fn})]

View File

@ -465,11 +465,11 @@
::set-open-bounties-sorting-type
(fn [db [_ sorting-type]]
(merge db {::db/open-bounties-sorting-type sorting-type
:bounty-page-number 1})))
:page-number 1})))
(reg-event-db
::set-open-bounty-filter-type
(fn [db [_ filter-type filter-value]]
(-> db
(assoc-in [::db/open-bounties-filters filter-type] filter-value)
(assoc :bounty-page-number 1))))
(assoc :page-number 1))))

View File

@ -2,7 +2,8 @@
(:require [re-frame.core :refer [reg-sub]]
[commiteth.db :as db]
[commiteth.ui-model :as ui-model]
[commiteth.common :refer [items-per-page]]))
[commiteth.common :refer [items-per-page]]
[clojure.string :as string]))
(reg-sub
:db
@ -139,6 +140,12 @@
(map :repo-owner)
set)))
(reg-sub
::open-bounties-owners-sorted
:<- [::open-bounties-owners]
(fn [owners _]
(sort-by string/lower-case owners)))
(reg-sub
::open-bounties-currencies
:<- [:open-bounties]

View File

@ -63,7 +63,7 @@
(let [created-at-date (-> created-at-inst inst-ms t-coerce/from-long)]
(t/within? filter-value-interval created-at-date)))))
(def bounty-filter-type-claims-options-def {::bounty-filter-type-claims-option|no-claims "With no claims"})
(def bounty-filter-type-claims-options-def {::bounty-filter-type-claims-option|no-claims "Not claimed yet"})
(def bounty-filter-type-claims-options (keys bounty-filter-type-claims-options-def))
@ -75,7 +75,8 @@
{::bounty-filter-type.name "Value"
::bounty-filter-type.category ::bounty-filter-type-category|range
::bounty-filter-type.min-val 0
::bounty-filter-type.max-val 1000
::bounty-filter-type.max-val 10000
::bounty-filter.type.header "$0 - $10000+"
::bounty-filter-type.predicate (fn [filter-value bounty]
(let [min-val (first filter-value)
max-val (second filter-value)]
@ -101,7 +102,7 @@
::bounty-filter-type|owner
{::bounty-filter-type.name "Owner"
::bounty-filter-type.category ::bounty-filter-type-category|multiple-dynamic-options
::bounty-filter-type.re-frame-subs-key-for-options :commiteth.subscriptions/open-bounties-owners
::bounty-filter-type.re-frame-subs-key-for-options :commiteth.subscriptions/open-bounties-owners-sorted
::bounty-filter-type.predicate (fn [filter-value bounty]
(->> filter-value
(some #{(:repo-owner bounty)})