diff --git a/src/oph/ehoks/palaute/opiskelija.clj b/src/oph/ehoks/palaute/opiskelija.clj index a4e9a2580..f79e121f6 100644 --- a/src/oph/ehoks/palaute/opiskelija.clj +++ b/src/oph/ehoks/palaute/opiskelija.clj @@ -68,7 +68,14 @@ (log/spyf :info "existing-heratteet!: before rk filtering: %s") (filterv #(= rahoituskausi (palaute/rahoituskausi (:heratepvm %)))) (log/spyf :info "existing-heratteet!: after rk filtering: %s") - (utils/assert-pred #(contains? #{0 1} (count %))) + ((fn [existing-palautteet] + (when (> (count existing-palautteet) 1) + (log/errorf (str "Found more than one existing herate for " + "`%s` of HOKS `%d` in rahoituskausi `%s`.") + kysely-type + (:id hoks) + rahoituskausi)) + existing-palautteet)) first))) (defn build! diff --git a/src/oph/ehoks/utils.clj b/src/oph/ehoks/utils.clj index f8f2a3ecc..24ce9afdc 100644 --- a/src/oph/ehoks/utils.clj +++ b/src/oph/ehoks/utils.clj @@ -1,7 +1,5 @@ (ns oph.ehoks.utils - (:require [clojure.string :as string] - [medley.core :refer [dissoc-in map-keys]]) - (:import (java.text Normalizer Normalizer$Form))) + (:require [medley.core :refer [dissoc-in map-keys]])) (defn apply-when "Apply function `f` to value `v` if predicate `(pred v)` returns `true`. @@ -9,14 +7,6 @@ [v pred f] (if (pred v) (f v) v)) -(defn assert-pred - "Takes a predicate `pred` and a value `v` that is given to the predicate. - Asserts that `(pred v)` returns `true` and then returns `v`. Useful when used - in a threading macro." - [pred v] - (assert (pred v)) - v) - (defn to-underscore-str [kw] (.replace (name kw) \- \_))