Commit 82fe8cfc authored by Joachim Schunk's avatar Joachim Schunk

fix namespace reference

parent 8f117b0b
Pipeline #47608 failed with stages
in 1 minute and 54 seconds
......@@ -8,6 +8,10 @@
[check-phys-vals tolerable-error?]]
[lernmeister.components.helper :refer [migrate-if-necessary]]))
(defn get-calculation-ids [exercise]
(reduce (fn [res item] (conj res (:id item)))
#{} (get-in exercise [:core :calculations])))
(defn no-negative-points [result]
(if (neg? (:points result))
(assoc result :points 0)
......@@ -44,6 +48,7 @@
(defmethod e-check/check-answer :calculation [exercise answer callback]
(let [migrated-answer (migrate-if-necessary answer :answer-scheme "calculation"
answer-scheme-version migrate-answer)]
(let [calculation-ids (get-calculation-ids exercise)
migrated-answer (migrate-if-necessary answer :answer-scheme "calculation"
answer-scheme-version (partial migrate-answer calculation-ids))]
(calculation-check exercise migrated-answer callback)))
......@@ -16,6 +16,7 @@
[answer-scheme-version migrate-answer]]
[lernmeister.components.exercise-types.calculation.check :refer [get-calculation-ids]]
......@@ -145,8 +146,7 @@
:collats-fn (:collats-fn @modal-state-atom)}]]]])
(defn exercise-renderer [exercise {:keys [result answer on-change]}]
(let [calculation-ids (reduce (fn [res item] (conj res (:id item)))
#{} (get-in exercise [:core :calculations]))
(let [calculation-ids (get-calculation-ids exercise)
ans-obj (or answer (fresh-answer-obj calculation-ids (get-in exercise [:core :with-units])))]
(if-let [migrated-answer (migrate-if-necessary ans-obj :answer-scheme "calculation" answer-scheme-version
(partial migrate-answer calculation-ids))]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment