Skip to content

Commit

Permalink
OY-4529 korjaus logiikkaan
Browse files Browse the repository at this point in the history
  • Loading branch information
marjakari committed Nov 6, 2023
1 parent 9faa31e commit 2c71ae0
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/cljs/ataru/virkailija/application/application_subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -917,14 +917,6 @@
(contains? selected-hakukohde-oids (str hakukohde)))
index)))))))

(re-frame/reg-sub
:application/review-note-indexes-excluding-eligibility
(fn [db]
(->> (-> db :application :review-notes)
(keep-indexed (fn [index {:keys [state-name _]}]
(when (not= "eligibility-state" state-name)
index))))))

(re-frame/reg-sub
:application/review-notes
(fn [db]
Expand All @@ -936,16 +928,17 @@
(set (-> db :application :selected-review-hakukohde-oids))))

(re-frame/reg-sub
:application/review-note-indexes-excluding-eligibility-for-selected-hakukohteet
(fn [_ _]
[(re-frame/subscribe [:application/review-note-indexes-excluding-eligibility])
(re-frame/subscribe [:application/selected-review-hakukohde-oids])])
(fn [[notes selected-review-hakukohde-oids] _]
(->> notes
(keep-indexed (fn [index {:keys [hakukohde]}]
(when (or (not hakukohde)
(selected-review-hakukohde-oids hakukohde))
index))))))
:application/review-note-indexes-excluding-eligibility-for-selected-hakukohteet
(fn [db [_]]
(let [selected-hakukohde-oids (set (get-in db [:application :selected-review-hakukohde-oids]))]
(keep-indexed
(fn [index {:keys [state-name hakukohde]}]
(when
(and (not= "eligibility-state" state-name)
(or (not hakukohde)
(contains? selected-hakukohde-oids (str hakukohde))))
index))
(get-in db [:application :review-notes])))))

(re-frame/reg-sub
:application/prioritize-hakukohteet?
Expand Down

0 comments on commit 2c71ae0

Please sign in to comment.