Skip to content

Commit

Permalink
Scenarios should no longer contain causality and type information. (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
eidekrist authored Jul 1, 2019
1 parent 3b33069 commit 4c79990
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 3 additions & 5 deletions src/cse_client/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,15 @@
(filter #(= (:model event) (:name %)))
first
:variables
(filter (fn [{:keys [name causality type]}]
(and (= name (:variable event))
(= causality (:causality event))
(= (str/lower-case type) (str/lower-case (:type event))))))
(filter (fn [{:keys [name]}]
(= name (:variable event))))
seq
boolean)]
(-> event
(assoc :model-valid? model-valid? :variable-valid? variable-valid? :valid? (and model-valid? variable-valid?))
(assoc :validation-message (cond
(not model-valid?) "Can't find a model with this name"
(not variable-valid?) "Can't find a variable with this name, type and causality")))))
(not variable-valid?) "Can't find a variable with this name")))))

(defn merge-defaults [db scenario]
(let [new-events (->> scenario
Expand Down
6 changes: 1 addition & 5 deletions src/cse_client/scenario.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@
[:th "Time"]
[:th "Model"]
[:th "Variable"]
[:th "Type"]
[:th "Causality"]
[:th "Action"]
[:th "Value"]]]
[:tbody
(map-indexed (fn [index {:keys [time model variable causality type action value model-valid? variable-valid? validation-message] :as event}]
(map-indexed (fn [index {:keys [time model variable action value model-valid? variable-valid? validation-message] :as event}]
[:tr {:key (str "scenario-" index "-event")}
[:td time]
[cellie model model-valid? validation-message]
[cellie variable variable-valid? validation-message]
[cellie type variable-valid? validation-message]
[cellie causality variable-valid? validation-message]
[:td action]
[:td value]])
(:events scenario))]]
Expand Down

0 comments on commit 4c79990

Please sign in to comment.