Commit 1387b895 authored by Joachim Schunk's avatar Joachim Schunk

make :error-relative input-range

parent 27308077
......@@ -5,6 +5,9 @@
[lernmeister.components.exercise-types.calchelper
:refer
[calc-change-fn get-collats-for-vec]]
[lernmeister.components.exercise-types.multistep-calculation.check
:refer
[number-obj]]
[lernmeister.components.exercise-types.calculation.components.migration
:refer
[migrate-exercise-atom]]
......@@ -25,7 +28,7 @@
(defn get-new-calculation []
{:id (get-unique-id "ae")
:name nil
:number {:significand nil :order-of-magnitude "0"}
:number number-obj
:correct-points 0
:incorrect-points 0
:error-relative 1})
......@@ -68,14 +71,11 @@
:on-change #(change-fn (conj base-path :name) (str/triml %))}]]]
[:div.column.is-half
[ui/field {:label "Fehler (in %)"}
[ui/input-text
{:value (:error-relative calculation "1")
:on-change (fn [value]
(when-let [v (-> value
(->>
(re-matches #"^\-?(0*)(([1-9]\d*)|0)$"))
(nth 2))]
(change-fn (conj base-path :error-relative) (edn/read-string v))))}]]]
[ui/input-range
{:value (:error-relative calculation)
:min 0
:max 5
:on-change #(change-fn (conj base-path :error-relative) %)}]]]
[:div.column.is-half
[ui/field {:label "Punkte (korrekt)"}
[ui/input-text
......
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