 (defn store-election-id [ctx]
   (if-let [election-id (generate-election-id ctx)]
     (let [id (:import-id ctx)]
+      (log/info "Storing election id")
       (save-election-id! election-id)
       (korma/update results
                     (korma/set-fields {:election_id election-id})


(defn store-spec-version [{:keys [spec-version import-id] :as ctx}]
  (when @spec-version
    (korma/update results
      (korma/set-fields {:spec_version @spec-version})
      (korma/where {:id import-id})))


(defn generate-public-id [ctx]
  (let [{:keys [date election-type state import-id]} (get-public-id-data ctx)]
    (log/info "Building public id")
    (build-public-id date election-type state import-id)))

(defn generate-election-id [ctx]
  (log/info "Building election id")
  (let [{:keys [date election-type state]} (get-public-id-data ctx)]
    (build-election-id date election-type state)))

(defn store-public-id [ctx]
  (let [id (:import-id ctx)
        public-id (generate-public-id ctx)]
    (log/info "Storing public id")
    (korma/update results
                  (korma/set-fields {:public_id public-id})
                  (korma/where {:id id}))
