Fixed the pin-image regression

This commit is contained in:
Simon Brooke 2018-09-23 13:27:56 +01:00
parent c575b52d01
commit 388bb3fb7d
5 changed files with 29 additions and 30 deletions

View file

@ -69,7 +69,7 @@
(fn [e]
(assoc e
:intentions
(db/list-intentions-by-elector db/*db* {:id (:id e)})))
(db/list-elector-intentions db/*db* {:id (:id e)})))
(db/list-electors-by-dwelling db/*db* {:id (:id d)}))))
(db/list-dwellings-by-address db/*db* {:id (:id a)}))))
addresses)))

View file

@ -2,6 +2,7 @@
:author "Simon Brooke"}
youyesyet.canvasser-app.gis
(:require [cljs.reader :refer [read-string]]
[clojure.string :refer [lower-case]]
[cemerick.url :refer (url url-encode)]
[day8.re-frame.http-fx]
[re-frame.core :refer [dispatch reg-event-db reg-event-fx subscribe]]
@ -66,13 +67,14 @@
(set
(remove
nil?
(map
:intention
(mapcat :electors
(:dwellings address)))))]
(map :option_id
(mapcat
:intentions
(mapcat :electors
(:dwellings address))))))]
(case (count intentions)
0 "unknown-pin"
1 (str (name (first intentions)) "-pin")
1 (lower-case (str (name (first intentions)) "-pin"))
"mixed-pin")))

View file

@ -181,6 +181,7 @@
;; TODO: why is this an `-fx`? Does it need to be?
(fn
[{db :db} [_ response]]
(js/console.log (str ":process-locality: " response))
(js/console.log (str "Updating locality data: " (count response) " addresses " ))
(refresh-map-pins)
{:db (assoc
@ -194,7 +195,7 @@
(fn
[{db :db} [_ response]]
;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing.
(js/console.log "Failed to fetch locality data")
(js/console.log (str "Failed to fetch locality data" response))
;; loop to do it again
(dispatch [:dispatch-later [{:ms 60000 :dispatch [:fetch-locality]}]])
{:db (assoc