add verified label

add verified label

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -230,9 +230,10 @@
          [:div.col-md-12
           [:h2.uppercase-header (if (= (count evidences) 1)  (t :badge/Evidence) (str (t :badge/Evidence) " (" (count evidences) ")") ) ]
           (reduce (fn [r evidence]
-                    (let [{:keys [description name evidence_type id url mtime ctime]} evidence]
+                    (let [{:keys [description name evidence_type id url mtime ctime properties]} evidence]
                       (conj r
                             [:div.modal-evidence
+                             (if (empty? properties) [:span.label.label-success (t :user/verified)])
                              [evidence-icon evidence_type]
                              [:div.content


Heh... if lein-swank depends on leiningen that'd be a circular dependency.

--- lein-swank/project.clj
+++ lein-swank/project.clj
@@ -1,3 +1,2 @@
 (defproject leiningen/lein-swank "1.0.0-SNAPSHOT"
-  :dependencies [[leiningen "1.0.0-SNAPSHOT"]
-                 [org.clojure/swank-clojure "1.0"]])
+  :dependencies [[org.clojure/swank-clojure "1.0"]])


fixes function to return sequence of valid acls, without any empty values

--- access-control-app/src/cmr/access_control/services/auth_util.clj
+++ access-control-app/src/cmr/access_control/services/auth_util.clj
@@ -74,11 +74,12 @@
                          (= action-description "delete") [:delete]
                          :else [permission])]
    (when (or legacy-guid concept-id)
-     (doseq [permission permissions]
-       (filter #(or (= concept-id (-> % :single-instance-object-identity :target-guid))
-                    (= legacy-guid (-> % :single-instance-object-identity :target-guid)))
-               (acl/get-permitting-acls context
-                                        :single-instance-object "GROUP_MANAGEMENT" permission))))))
+     (remove empty?
+       (for [permission permissions]
+         (filter #(or (= concept-id (-> % :single-instance-object-identity :target-guid))
+                      (= legacy-guid (-> % :single-instance-object-identity :target-guid)))
+                 (acl/get-permitting-acls context
+                                          :single-instance-object "GROUP_MANAGEMENT" permission)))))))
 (defn- describe-group
   [group]
   (let [{:keys [provider-id]} group]


Added print message to core.cljs

Added print message to core.cljs

--- src/leiningen/new/figwheel/core.cljs
+++ src/leiningen/new/figwheel/core.cljs
@@ -6,6 +6,10 @@
               ))

 (enable-console-print!)
+
+(println "Edits to this text should show up in your developer console.")
+
+;; define your app data so that it doesn't get over-written on reload

 (defonce app-state (atom {:text "Hello world!"}))
 {{#om?}}


Show zero line in charts

Show zero line in charts

--- src-cljs/acfe/chart.cljs
+++ src-cljs/acfe/chart.cljs
@@ -28,6 +28,7 @@
 		final-rows (map (partial map string->float) (cons first-row rest-rows))
 		data (.arrayToDataTable google.visualization (clj->js final-rows))
 		opts {:title (first first-row)
+			  :vAxis {:minValue 0}
 			  :legend {:position "top" :maxLines 3}
 			  :isStacked (if stacked? "percent" false)}
 		chart (case chart-type


Fix user-guide

Fix user-guide

--- dev/src/yada/dev/user_guide.clj
+++ dev/src/yada/dev/user_guide.clj
@@ -373,7 +373,7 @@
             (->
              (yada (fn [ctx]
                      (body component (post-process-doc component xbody (into {} examples) config) config))
-                   {:produces (mime/string->media-type "text/html;charset=utf-8")})
+                   {:produces ["text/html;charset=utf-8"]})
              (tag ::user-guide))))]

         ["/examples/"


Remove a couple of unnecessary divs

Remove a couple of unnecessary divs

--- src/cljs/cglossa/search_inputs/cwb/extended.cljs
+++ src/cljs/cglossa/search_inputs/cwb/extended.cljs
@@ -126,72 +126,70 @@
                       show-remove-row-btn? show-remove-term-btn?]
   (let [term-val @wrapped-term]
     [:div.table-cell
-     [:div
-      [:div.multiword-term
-       [:div.control-group
-        [:div {:style {:display "table"}}
-         [:div.dropdown.table-row
-          (when first?
-            [:div.table-cell.remove-row-btn-container
-             [remove-row-btn show-remove-row-btn? wrapped-query]])
-          [:div.table-cell
-           [:div.input-group
-            [:span.input-group-addon.dropdown-toggle {:data-toggle "dropdown"
-                                                      :style       {:cursor "pointer"}}
-             [:span.glyphicon.glyphicon-menu-hamburger]]
-            [:input.form-control.multiword-field {:ref           "searchfield"
-                                                  :type          "text"
-                                                  :default-value (str/replace (:word term-val)
-                                                                              #"^\.\*$"
-                                                                              "")
-                                                  ;:on-change     #(on-text-changed)
-                                                  :on-key-down   #(on-key-down % wrapped-query)}]
-            (when show-remove-term-btn?
-              [:span.input-group-addon {:title    " Remove word "
-                                        :style    {:cursor "pointer"}
-                                        :on-click #(reset! wrapped-term nil)}
-               [:span.glyphicon.glyphicon-minus]])
-            (when last?
-              [:div.add-search-word
-               [:button.btn.btn-info.btn-sm {:type     "button"
-                                             :title    "Add search word"
-                                             :on-click #(swap! wrapped-query
-                                                               update :query str " []")}
-                [:span.glyphicon.glyphicon-plus]]])]]]
-         [:div.table-row
-          (when first?
-            [:div.table-cell])
-          [:div.table-cell
-           [:div.word-checkboxes
+     [:div.multiword-term
+      [:div.control-group
+       [:div.dropdown.table-row
+        (when first?
+          [:div.table-cell.remove-row-btn-container
+           [remove-row-btn show-remove-row-btn? wrapped-query]])
+        [:div.table-cell
+         [:div.input-group
+          [:span.input-group-addon.dropdown-toggle {:data-toggle "dropdown"
+                                                    :style       {:cursor "pointer"}}
+           [:span.glyphicon.glyphicon-menu-hamburger]]
+          [:input.form-control.multiword-field {:ref           "searchfield"
+                                                :type          "text"
+                                                :default-value (str/replace (:word term-val)
+                                                                            #"^\.\*$"
+                                                                            "")
+                                                ;:on-change     #(on-text-changed)
+                                                :on-key-down   #(on-key-down % wrapped-query)}]
+          (when show-remove-term-btn?
+            [:span.input-group-addon {:title    " Remove word "
+                                      :style    {:cursor "pointer"}
+                                      :on-click #(reset! wrapped-term nil)}
+             [:span.glyphicon.glyphicon-minus]])
+          (when last?
+            [:div.add-search-word
+             [:button.btn.btn-info.btn-sm {:type     "button"
+                                           :title    "Add search word"
+                                           :on-click #(swap! wrapped-query
+                                                             update :query str " []")}
+              [:span.glyphicon.glyphicon-plus]]])]]]
+       [:div.table-row
+        (when first?
+          [:div.table-cell])
+        [:div.table-cell
+         [:div.word-checkboxes
+          [:label.checkbox-inline
+           [:input {:type    "checkbox"
+                    :checked (:lemma? term-val)
+                    ;:on-change #(on-lemma?-changed)
+                    }] "Lemma"]
+          [:label.checkbox-inline
+           [:input {:type    "checkbox"
+                    :title   "Start of word"
+                    :checked (:start? term-val)
+                    ;:on-change #(on-start?-changed)
+                    }] "Start"]
+          [:label.checkbox-inline
+           [:input {:type    "checkbox"
+                    :title   "End of word"
+                    :checked (:end? term-val)
+                    ;:on-change #(on-end?-changed)
+                    }] "End"]]
+         (when has-phonetic?
+           [:div
             [:label.checkbox-inline
              [:input {:type    "checkbox"
-                      :checked (:lemma? term-val)
-                      ;:on-change #(on-lemma?-changed)
-                      }] "Lemma"]
-            [:label.checkbox-inline
-             [:input {:type    "checkbox"
-                      :title   "Start of word"
-                      :checked (:start? term-val)
-                      ;:on-change #(on-start?-changed)
-                      }] "Start"]
-            [:label.checkbox-inline
-             [:input {:type    "checkbox"
-                      :title   "End of word"
-                      :checked (:end? term-val)
-                      ;:on-change #(on-end?-changed)
-                      }] "End"]]
-           (when has-phonetic?
-             [:div
-              [:label.checkbox-inline
-               [:input {:type    "checkbox"
-                        :checked (:phonetic? term-val)
-                        ;:on-change #(on-phonetic?-changed)
-                        }] "Phonetic form"]])]]
-         [:div.table-row
-          (when first?
-            [:div.table-cell])
-          [:div.tag-list.table-cell {:ref "taglist"}
-           [:div.tags]]]]]]]]))
+                      :checked (:phonetic? term-val)
+                      ;:on-change #(on-phonetic?-changed)
+                      }] "Phonetic form"]])]]
+       [:div.table-row
+        (when first?
+          [:div.table-cell])
+        [:div.tag-list.table-cell {:ref "taglist"}
+         [:div.tags]]]]]]))

 (defn extended
   "Search view component with text inputs, checkboxes and menus


Added shorter test cases to Vector Average problem

--- src/clojush/problems/software/vector_average.clj
+++ src/clojush/problems/software/vector_average.clj
@@ -42,12 +42,17 @@
 ;; inputs is either a list or a function that, when called, will create a
 ;; random element of the set.
 (def vector-average-data-domains
-  [[(list [0.0] [100.0] [-100.0]) 3 0] ;; Length 1 vectors
+  [[(list [0.0] [100.0] [-100.0] [1000.0] [-1000.0]) 5 0] ;; Length-1 vectors
+   [(fn [] (vector-average-input 1)) 45 500] ;; Random Length-1 vectors
    [(list [2.0 129.0]
           [0.12345 -4.678]
-          [999.99 74.113]) 3 0] ;; Length 2 vectors
-   [(fn [] (vector-average-input 50)) 4 50] ;; Length 50 vectors
-   [(fn [] (vector-average-input (inc (lrand-int 50)))) 90 950] ;; Random length, random floats
+          [999.99 74.113]
+          [987.654321 995.0003]
+          [-788.788 -812.19]) 5 0] ;; Length-2 vectors
+   [(fn [] (vector-average-input 2)) 45 500] ;; Random Length-2 vectors
+   [(fn [] (vector-average-input (+ 3 (lrand-int 3)))) 50 500] ;; Random Length-3, -4, and -5 vectors
+   [(fn [] (vector-average-input 50)) 5 50] ;; Random Length-50 vectors
+   [(fn [] (vector-average-input (inc (lrand-int 50)))) 95 1000] ;; Random length, random floats
    ])

 ;;Can make Vector Average test data like this:


Better handling of single char reported Elm errors

--- src/lt/plugins/elm_light/linter.cljs
+++ src/lt/plugins/elm_light/linter.cljs
@@ -132,11 +132,14 @@
     (dom/focus ui)))

+(defn- mark-range [ed {:keys [from to] :as code-range}]
+  (if-not (= from to )
+    code-range
+    {:from (assoc from :ch 0)
+     :to (assoc to :ch (editor/line-length ed (:line from)))}))
+
 (defn create-mark [ed {:keys [category code-range]}]
-  (let [from (:from code-range)
-        to (if-not (= (:to code-range) from)
-             (:to code-range)
-             (assoc from :ch (dec (editor/line-length ed (:line from)))))]
+  (let [{:keys [from to]} (mark-range ed code-range)]
     (editor/mark ed
                  from
                  to


Add colors and palette vars

Add colors and palette vars

--- src/elfeed_cljsrn/android/core.cljs
+++ src/elfeed_cljsrn/android/core.cljs
@@ -5,6 +5,17 @@
             [elfeed-cljsrn.events]
             [elfeed-cljsrn.subs])
   (:import [goog.i18n DateTimeFormat]))
+
+(def colors {:white "#FFFFFF"})
+(def palette {:dark-primary "#00796B"
+              :primary "#009688"
+              :light-primary "#B2DFDB"
+              :accent "#CDDC39"
+              :text (:white colors)
+              :primary-text "#212121"
+              :secondary-text "#757575"
+              :divider "#BDBDBD"
+              :error "#F44336"})

 (def MaterialIcons (js/require "react-native-vector-icons/MaterialIcons"))
 (def icon (r/adapt-react-class MaterialIcons))


Factor tests

Factor tests

--- test/onyx/coordinator/simulation_test.clj
+++ test/onyx/coordinator/simulation_test.clj
@@ -210,17 +210,77 @@
                               [?t :task/ingress-queues ?qs]]]
               (is (= (d/q inc-query db) (d/q out-query db))))))))))

+(defn test-task-life-cycle
+  [{:keys [log sync sync-spy ack-ch-spy completion-ch-spy offer-ch-spy
+           peer-node payload-node next-payload-node task-name]}]
+  (testing "The payload node is populated"
+    (let [event (<!! sync-spy)]
+      (is (= (:path event) payload-node))))
+
+  (let [db (d/db (:conn log))]
+    (testing "It receives the task"
+      (let [task (:task (extensions/read-place sync payload-node))
+            query '[:find ?task :in $ ?t-name :where [?task :task/name ?t-name]]]
+        (is (= (:db/id task) (ffirst (d/q query db task-name))))))
+
+    (testing "The peer is marked as :acking the task"
+      (let [query '[:find ?task :in $ ?t-name :where
+                    [?peer :peer/status :acking]
+                    [?peer :peer/task ?task]
+                    [?task :task/name ?t-name]]]
+        (is (= (count (d/q query db task-name)) 1))))
+
+    (testing "The payload node contains the other node paths"
+      (let [nodes (:nodes (extensions/read-place sync payload-node))]
+        (is (empty?
+             (clojure.set/difference (into #{} (keys nodes))
+                                     #{:payload :ack :completion :status})))))
+
+    (testing "Touching the ack node triggers the callback"
+      (let [nodes (:nodes (extensions/read-place sync payload-node))]
+        (extensions/touch-place sync (:ack nodes))
+        (let [event (<!! ack-ch-spy)]
+          (= (:path event) (:ack nodes)))))
+
+    (extensions/write-place sync peer-node next-payload-node)
+    (extensions/on-change sync next-payload-node #(>!! sync-spy %))
+
+    (testing "Touching the completion node triggers the callback"
+      (let [nodes (:nodes (extensions/read-place sync payload-node))]
+        (extensions/touch-place sync (:completion nodes))
+        (let [event (<!! completion-ch-spy)]
+          (= (:path event) (:completion nodes)))))
+
+    (testing "The offer channel receives the tx id of the completion"
+      (let [tx-id (<!! offer-ch-spy)
+            db (d/as-of (d/db (:conn log)) tx-id)]
+
+        (testing "The peer's nodes have been stripped"
+          (let [query '[:find ?payload ?ack ?status ?completion :in $ ?peer-node :where
+                        [?p :peer/status :idle]
+                        [?p :node/peer ?peer-node]
+                        [?p :node/payload ?payload]
+                        [?p :node/ack ?ack]
+                        [?p :node/status ?status]
+                        [?p :node/completion ?completion]]
+                result (d/q query db peer-node)]
+            (is (empty? result))))))))
+
 (deftest plan-one-job-one-peer
   (with-system
     (fn [coordinator sync log]
       (let [peer-node (extensions/create sync :peer)
+
             in-payload-node (extensions/create sync :payload)
             inc-payload-node (extensions/create sync :payload)
             out-payload-node (extensions/create sync :payload)
+            future-payload-node (extensions/create sync :payload)
+
             sync-spy (chan 1)
             ack-ch-spy (chan 1)
             offer-ch-spy (chan 1)
             completion-ch-spy (chan 1)
+
             catalog [{:onyx/name :in
                       :onyx/direction :input
                       :onyx/type :queue
@@ -253,161 +313,30 @@
           (<!! offer-ch-spy)
           (<!! offer-ch-spy))

-        (testing "The payload node is populated"
-          (let [event (<!! sync-spy)]
-            (is (= (:path event) in-payload-node))))
-
-        (let [db (d/db (:conn log))]
-          (testing "It receives the :in task"
-            (let [task (:task (extensions/read-place sync in-payload-node))
-                  query '[:find ?task :where [?task :task/name :in]]]
-              (is (= (:db/id task) (ffirst (d/q query db))))))
-
-          (testing "The peer is marked as :acking the task"
-            (let [query '[:find ?task :where
-                          [?peer :peer/status :acking]
-                          [?peer :peer/task ?task]
-                          [?task :task/name :in]]]
-              (is (= (count (d/q query db)) 1))))
-
-          (testing "The payload node contains the other node paths"
-            (let [nodes (:nodes (extensions/read-place sync in-payload-node))]
-              (is (= (clojure.set/difference (into #{} (keys nodes))
-                                             #{:payload :ack :completion :status})
-                     #{})))))
-
-        (testing "Touching the ack node triggers the callback"
-          (let [nodes (:nodes (extensions/read-place sync in-payload-node))]
-            (extensions/touch-place sync (:ack nodes))
-            (let [event (<!! ack-ch-spy)]
-              (= (:path event) (:ack nodes)))))
-
-        (extensions/write-place sync peer-node inc-payload-node)
-        (extensions/on-change sync inc-payload-node #(>!! sync-spy %))
-
-        (testing "Touching the completion node triggers the callback"
-          (let [nodes (:nodes (extensions/read-place sync in-payload-node))]
-            (extensions/touch-place sync (:completion nodes))
-            (let [event (<!! completion-ch-spy)]
-              (= (:path event) (:completion nodes)))))
-
-        (testing "The offer channel receives the tx id of the completion"
-          (let [tx-id (<!! offer-ch-spy)
-                db (d/as-of (d/db (:conn log)) tx-id)]
-
-            (testing "The peer's nodes have been stripped"
-              (let [query '[:find ?payload ?ack ?status ?completion :in $ ?peer-node :where
-                            [?p :peer/status :idle]
-                            [?p :node/peer ?peer-node]
-                            [?p :node/payload ?payload]
-                            [?p :node/ack ?ack]
-                            [?p :node/status ?status]
-                            [?p :node/completion ?completion]]
-                    result (d/q query db peer-node)]
-                (is (empty? result))))))
-
-        (testing "The payload node is populated"
-          (let [event (<!! sync-spy)]
-            (is (= (:path event) inc-payload-node))))
-
-        (let [db (d/db (:conn log))]
-          (testing "It receives the :inc task"
-            (let [task (:task (extensions/read-place sync inc-payload-node))
-                  query '[:find ?task :where [?task :task/name :inc]]]
-              (is (= (:db/id task) (ffirst (d/q query db))))))
-
-          (testing "The peer is marked as :acking the task"
-            (let [query '[:find ?task :where
-                          [?peer :peer/status :acking]
-                          [?peer :peer/task ?task]
-                          [?task :task/name :inc]]]
-              (is (= (count (d/q query db)) 1))))
-
-          (testing "The payload node contains the other node paths"
-            (let [nodes (:nodes (extensions/read-place sync inc-payload-node))]
-              (is (= (clojure.set/difference (into #{} (keys nodes))
-                                             #{:payload :ack :completion :status})
-                     #{}))))
-
-          (testing "Touching the ack node triggers the callback"
-            (let [nodes (:nodes (extensions/read-place sync inc-payload-node))]
-              (extensions/touch-place sync (:ack nodes))
-              (let [event (<!! ack-ch-spy)]
-                (= (:path event) (:ack nodes)))))
-
-          (extensions/write-place sync peer-node out-payload-node)
-          (extensions/on-change sync out-payload-node #(>!! sync-spy %))
-
-          (testing "Touching the completion node triggers the callback"
-            (let [nodes (:nodes (extensions/read-place sync inc-payload-node))]
-              (extensions/touch-place sync (:completion nodes))
-              (let [event (<!! completion-ch-spy)]
-                (= (:path event) (:completion nodes)))))
-
-          (testing "The offer channel receives the tx id of the completion"
-            (let [tx-id (<!! offer-ch-spy)
-                  db (d/as-of (d/db (:conn log)) tx-id)]
-
-              (testing "The peer's nodes have been stripped"
-                (let [query '[:find ?payload ?ack ?status ?completion :in $ ?peer-node :where
-                              [?p :peer/status :idle]
-                              [?p :node/peer ?peer-node]
-                              [?p :node/payload ?payload]
-                              [?p :node/ack ?ack]
-                              [?p :node/status ?status]
-                              [?p :node/completion ?completion]]
-                      result (d/q query db peer-node)]
-                  (is (empty? result))))))
-
-          (testing "The payload node is populated"
-            (let [event (<!! sync-spy)]
-              (is (= (:path event) out-payload-node))))
-
-          (let [db (d/db (:conn log))]
-            (testing "It receives the :out task"
-              (let [task (:task (extensions/read-place sync out-payload-node))
-                    query '[:find ?task :where [?task :task/name :out]]]
-                (is (= (:db/id task) (ffirst (d/q query db))))))
-
-            (testing "The peer is marked as :acking the task"
-              (let [query '[:find ?task :where
-                            [?peer :peer/status :acking]
-                            [?peer :peer/task ?task]
-                            [?task :task/name :out]]]
-                (is (= (count (d/q query db)) 1))))
-
-            (testing "The payload node contains the other node paths"
-              (let [nodes (:nodes (extensions/read-place sync out-payload-node))]
-                (is (= (clojure.set/difference (into #{} (keys nodes))
-                                               #{:payload :ack :completion :status})
-                       #{}))))
-
-            (testing "Touching the ack node triggers the callback"
-              (let [nodes (:nodes (extensions/read-place sync out-payload-node))]
-                (extensions/touch-place sync (:ack nodes))
-                (let [event (<!! ack-ch-spy)]
-                  (= (:path event) (:ack nodes)))))
-
-            (testing "Touching the completion node triggers the callback"
-              (let [nodes (:nodes (extensions/read-place sync out-payload-node))]
-                (extensions/touch-place sync (:completion nodes))
-                (let [event (<!! completion-ch-spy)]
-                  (= (:path event) (:completion nodes)))))
-
-            (testing "The offer channel receives the tx id of the completion"
-              (let [tx-id (<!! offer-ch-spy)
-                    db (d/as-of (d/db (:conn log)) tx-id)]
-
-                (testing "The peer's nodes have been stripped"
-                  (let [query '[:find ?payload ?ack ?status ?completion :in $ ?peer-node :where
-                                [?p :peer/status :idle]
-                                [?p :node/peer ?peer-node]
-                                [?p :node/payload ?payload]
-                                [?p :node/ack ?ack]
-                                [?p :node/status ?status]
-                                [?p :node/completion ?completion]]
-                        result (d/q query db peer-node)]
-                    (is (empty? result))))))))))
+        (let [base-cycle {:log log
+                          :sync sync
+                          :sync-spy sync-spy
+                          :ack-ch-spy ack-ch-spy
+                          :offer-ch-spy offer-ch-spy
+                          :completion-ch-spy completion-ch-spy
+                          :peer-node peer-node}]
+          (test-task-life-cycle
+           (assoc base-cycle
+             :task-name :in
+             :payload-node in-payload-node
+             :next-payload-node inc-payload-node))
+
+          (test-task-life-cycle
+           (assoc base-cycle
+             :task-name :inc
+             :payload-node inc-payload-node
+             :next-payload-node out-payload-node))
+
+          (test-task-life-cycle
+           (assoc base-cycle
+             :task-name :out
+             :payload-node out-payload-node
+             :next-payload-node future-payload-node)))))
     {:eviction-delay 500000}))

 (run-tests 'onyx.coordinator.simulation-test)


Beef up tests.

Beef up tests.

--- test/onyx/coordinator/simulation_test.clj
+++ test/onyx/coordinator/simulation_test.clj
@@ -28,10 +28,11 @@
         (>!! (:born-peer-ch-head coordinator) peer)
         (<!! offer-ch-spy)

-        (let [query '[:find ?p :where [?e :peer/place ?p]]
-              result (d/q query (d/db (:conn log)))]
-          (is (= (count result) 1))
-          (is (= (ffirst result) peer)))))))
+        (testing "There is one peer"
+            (let [query '[:find ?p :where [?e :peer/place ?p]]
+                  result (d/q query (d/db (:conn log)))]
+              (is (= (count result) 1))
+              (is (= (ffirst result) peer))))))))

 (deftest peer-joins-and-dies
   (with-system
@@ -46,9 +47,10 @@
         (extensions/delete sync peer)
         (<!! evict-ch-spy)

-        (let [query '[:find ?p :where [?e :peer/place ?p]]
-              result (d/q query (d/db (:conn log)))]
-          (is (zero? (count result))))))))
+        (testing "There are no peers"
+            (let [query '[:find ?p :where [?e :peer/place ?p]]
+                  result (d/q query (d/db (:conn log)))]
+              (is (zero? (count result)))))))))

 (deftest plan-one-job-no-peers
   (with-system
@@ -73,22 +75,55 @@

         (let [job-id (<!! offer-ch-spy)
               db (d/db (:conn log))]
-          (let [query '[:find ?j :in $ ?id :where [?j :job/id ?id]]
-                result (d/q query db job-id)]
-            (is (= (count result) 1)))

-          (let [query '[:find ?t :where [?t :task/name]]
+          (testing "There is one job"
+              (let [query '[:find ?j :in $ ?id :where [?j :job/id ?id]]
+                    result (d/q query db job-id)]
+                (is (= (count result) 1))))
+
+          (testing "There are three tasks")
+          (let [query '[:find ?n :where [?t :task/name ?n]]
                 result (d/q query db)]
-            (is #{:in :inc :out}))
+            (is (= result #{[:in] [:inc] [:out]})))

+          (testing ":in's ingress queue is preset"
+            (let [query '[:find ?qs :where
+                          [?t :task/name :in]
+                          [?t :task/ingress-queues ?qs]]
+                  result (d/q query db)]
+              (is (= result #{["in-queue"]}))))
+
+          (testing ":out's ingress queue is preset"
+            (let [query '[:find ?qs :where
+                          [?t :task/name :out]
+                          [?t :task/ingress-queues ?qs]]
+                  result (d/q query db)]
+              (is (= result #{["out-queue"]}))))
+
+          (testing ":out has no egress queue"
+            (let [query '[:find ?qs :where
+                          [?t :task/name :out]
+                          [?t :task/egress-queues ?qs]]
+                  result (d/q query db)]
+              (is (empty? result))))
+
+          (testing ":inc's ingress queue is :in's egress queue")
           (let [in-query '[:find ?qs :where
                            [?t :task/name :in]
                            [?t :task/egress-queues ?qs]]
                 inc-query '[:find ?qs :where
                             [?t :task/name :inc]
                             [?t :task/ingress-queues ?qs]]]
-            (contains? (into #{} (first (d/q in-query db)))
-                       (into #{} (first (d/q inc-query db))))))))))
+            (is (= (d/q in-query db) (d/q inc-query db))))
+
+          (testing ":out's ingess queue is :inc's egress queue"
+            (let [inc-query '[:find ?qs :where
+                              [?t :task/name :inc]
+                              [?t :task/egress-queues ?qs]]
+                  out-query '[:find ?qs :where
+                              [?t :task/name :out]
+                              [?t :task/ingress-queues ?qs]]]
+              (is (= (d/q inc-query db) (d/q out-query db))))))))))

 (run-tests 'onyx.coordinator.simulation-test)


fix build-report hook api

fix build-report hook api

kwargs bad ...

--- src/main/shadow/cljs/build_report.clj
+++ src/main/shadow/cljs/build_report.clj
@@ -303,40 +303,42 @@

 (defn hook
   {::build/stages #{:configure :flush}}
-  [{::build/keys [stage mode]
-    :as build-state}
-   & {:keys [output-to]
-      :as opts}]
-
-  (if-not (= :release mode)
-    build-state
-
-    (cond
-      (= :configure stage)
-      (if (get-in build-state [:compiler-options :source-map])
-        build-state
-        ;; force generating source maps if not enabled already, but don't link them
-        (update build-state :compiler-options merge {:source-map true :source-map-comment false}))
-
-      (get-in build-state [:compiler-options :pseudo-names])
-      (do (build/log build-state {:type ::pseudo-names})
-          build-state)
-
-      :else
-      (let [bundle-info
-            (extract-report-data build-state)
-
-            output-file
-            (if (seq output-to)
-              (io/file output-to)
-              (data/output-file build-state "report.html"))]
-
-        (generate-html build-state bundle-info output-file opts)
-
-        (build/log build-state {:type ::report-to :path (.getAbsolutePath output-file)})
-
-        build-state
-        ))))
+  ([build-state]
+   (hook build-state {}))
+  ([{::build/keys [stage mode]
+     :as build-state}
+    {:keys [output-to]
+     :as opts}]
+
+   (if-not (= :release mode)
+     build-state
+
+     (cond
+       (= :configure stage)
+       (if (get-in build-state [:compiler-options :source-map])
+         build-state
+         ;; force generating source maps if not enabled already, but don't link them
+         (update build-state :compiler-options merge {:source-map true :source-map-comment false}))
+
+       (get-in build-state [:compiler-options :pseudo-names])
+       (do (build/log build-state {:type ::pseudo-names})
+           build-state)
+
+       :else
+       (let [bundle-info
+             (extract-report-data build-state)
+
+             output-file
+             (if (seq output-to)
+               (io/file output-to)
+               (data/output-file build-state "report.html"))]
+
+         (generate-html build-state bundle-info output-file opts)
+
+         (build/log build-state {:type ::report-to :path (.getAbsolutePath output-file)})
+
+         build-state
+         )))))

 ;; FIXME: parse args properly, need support for tag and output-dir
 (defn -main [build-id report-file]


adding back tests that were commented

adding back tests that were commented

--- test/sparkling/ml/classification_test.clj
+++ test/sparkling/ml/classification_test.clj
@@ -32,7 +32,6 @@
        "valid params passed "
        (t/is (= (.getSmoothing (cl/naive-bayes {:smoothing 0.1})) 0.1 ))))))

-(comment
 (t/deftest classifier-metric
   (s/with-context c cconf
     (let [sqc (mlc/sql-context c)
@@ -94,5 +93,3 @@
              ;validate using cross-validation as usual
              cv (v/cross-validator (assoc eval-map :estimator mlpipe))]
          (t/is (> (first (v/avg-cv-metrics cv df)) 0.95)))))))
-
-  )


clojure: more progress toward new morphism function

--- clojure/org/gavrog/clojure/pgraph_morphisms.clj
+++ clojure/org/gavrog/clojure/pgraph_morphisms.clj
@@ -70,13 +70,18 @@
                          [0 k cl]
                          [(- (count cl)) (conj k key) cl]))))))))

-(defn node-signatures [net]
+(defn node-classification [net]
   (let [pos (barycentric-positions net)
         nodes (iterator-seq (.nodes net))
         dia (diameter net)
         shells (for [v nodes]
                  (vec (map vec (take (inc dia) (shell-positions net pos v)))))]
     (classify-recursively (zipmap nodes shells))))
+
+(defn node-signatures [net]
+  (let [nclass (node-classification net)]
+    (when (every? (fn [xs] (== 1 (count xs))) (vals nclass))
+      (into {} (for [[key vals] nclass] [(first vals) key])))))

 (defn map-vv [f vv]
   (into (vector) (map #(into (vector) (map f %)) vv)))
@@ -92,16 +97,21 @@
     (.set M* n m (Whole/ONE))
     M*))

-(defn morphism [v w M]
-  (if (.isUnimodularIntegerMatrix M)
-    (try
-      (Morphism. v w (Operator. (extend-matrix M)))
-      (catch Morphism$NoSuchMorphismException ex nil))))
+(defn morphism [net v w M]
+  (when (.isUnimodularIntegerMatrix M)
+    (let [sigs (node-signatures net)
+          d (.minus (first (first (sigs w))) (first (first (sigs v))))
+          op (.times (Operator. (extend-matrix M)) (Operator. d))]
+      (if (= (map-sig op (sigs v)) (sigs w))
+        (println "@@" v w op " okay! @@"))
+      (try
+        (Morphism. v w op)
+        (catch Morphism$NoSuchMorphismException ex nil)))))

 (defn symmetries [net]
   (let [bases (iterator-seq (.iterator (.characteristicBases net)))
         b (first bases)
         start #(.source (.get % 0))
         mat #(.differenceMatrix net %)
-        iso #(morphism (start b) (start %) (Matrix/solve (mat b) (mat %)))]
+        iso #(morphism net (start b) (start %) (Matrix/solve (mat b) (mat %)))]
     (->> bases (map iso) (filter identity))))


create a 'fast' models2 that doesn't load all the grammar stuff

--- src/babel/directory.cljc
+++ src/babel/directory.cljc
@@ -13,8 +13,48 @@

 ;; TODO: understand promises, futures, (deliver), etc, better: this code is susceptible to
 ;; race conditions when used with pmap (e.g. with generate)
-;; TODO: make finer-grained distinction between things that are slow to load (lexicon and indices)
-;; vs fast to load: e.g. simple constant values and simple maps of the same.
+
+
+(def models2
+;; make finer-grained distinction between things that are slow to load (lexicon and indices)
+  ;; vs fast to load: e.g. simple constant values and simple maps of the same.
+  (let [en (promise)
+        es (promise)
+        fr (promise)
+        la (promise)
+        it (promise)]
+    {:en (fn []
+           (if (realized? en)
+             en
+             (deliver en {})))
+     :es (fn []
+           (if (realized? es)
+             es
+             (deliver es
+                      (let [model {}]
+                        (conj model
+                              {:tenses babel.espanol.grammar/tenses})))))
+     :fr (fn []
+           (if (realized? fr)
+             fr
+             (deliver fr
+                      (let [model {}]
+                        (conj model
+                              {:tenses babel.francais.grammar/tenses})))))
+     :la (fn []
+           (if (realized? la)
+             la
+             (deliver la
+                      (let [model {}]
+                        (conj model)))))
+     :it (fn []
+           (if (realized? it)
+             it
+             (deliver it
+                      (let [model {}]
+                        (conj model
+                              {:tenses babel.italiano.grammar/tenses})))))}))
+
 (def models
   (let [en (promise)
         es (promise)


conditionalize cljs.env/ensure usage

conditionalize cljs.env/ensure usage

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -7,13 +7,14 @@
 ;   You must not remove this notice, or any other, from this software.

 (ns cljs.compiler
-  (:refer-clojure :exclude [munge macroexpand-1])
-  #?(:cljs (:require-macros [cljs.compiler.macros :refer [emit-wrap]]))
+  (:refer-clojure :exclude [munge macroexpand-1 ensure])
+  #?(:cljs (:require-macros [cljs.compiler.macros :refer [emit-wrap]]
+                            [cljs.env.macros :refer [ensure]]))
   #?(:clj (:require [cljs.util :as util]
                     [clojure.java.io :as io]
                     [clojure.string :as string]
                     [clojure.tools.reader :as reader]
-                    [cljs.env :as env]
+                    [cljs.env :as env :refer [ensure]]
                     [cljs.tagged-literals :as tags]
                     [cljs.analyzer :as ana]
                     [cljs.source-map :as sm]
@@ -130,7 +131,7 @@
 (defmulti emit* :op)

 (defn emit [ast]
-  (env/ensure
+  (ensure
     (when *source-map-data*
       (let [{:keys [env]} ast]
         (when (:line env)
@@ -1047,7 +1048,7 @@
    (defn compile-file*
      ([src dest] (compile-file* src dest nil))
      ([src dest opts]
-      (env/ensure
+      (ensure
         (with-core-cljs opts
           (fn []
             (when (or ana/*verbose* (:verbose opts))
@@ -1131,7 +1132,7 @@
      "Return true if the src file requires compilation."
      ([src dest] (requires-compilation? src dest nil))
      ([^File src ^File dest opts]
-      (env/ensure
+      (ensure
         (or (not (.exists dest))
             (> (.lastModified src) (.lastModified dest))
             (let [version' (util/compiled-by-version dest)


More scan tests with 2 keys.

More scan tests with 2 keys.

--- src/cbfg/store-test.cljs
+++ src/cbfg/store-test.cljs
@@ -210,6 +210,42 @@
                         m @n]
                     (and (e n (atake test-scan c)
                             {:status :part, :opaque m, :key "a", :sq 1, :val "A"}
+                            nil)
+                         (e n (atake test-scan c)
+                            {:status :ok, :opaque m}
+                            (atake test-scan c))))
+                  (let [c (store/store-set test-scan s @n "c" 0 "C" :set)]
+                    (e n (atake test-scan c)
+                       {:status :ok, :key "c", :opaque @n, :sq 2}
+                       (atake test-scan c)))
+                  (let [c (store/store-scan test-scan s @n "a" "z")
+                        m @n]
+                    (and (e n (atake test-scan c)
+                            {:status :part, :opaque m, :key "a", :sq 1, :val "A"}
+                            nil)
+                         (e n (atake test-scan c)
+                            {:status :part, :opaque m, :key "c", :sq 2, :val "C"}
+                            nil)
+                         (e n (atake test-scan c)
+                            {:status :ok, :opaque m}
+                            (atake test-scan c))))
+                  (let [c (store/store-scan test-scan s @n "a" "c")
+                        m @n]
+                    (and (e n (atake test-scan c)
+                            {:status :part, :opaque m, :key "a", :sq 1, :val "A"}
+                            nil)
+                         (e n (atake test-scan c)
+                            {:status :ok, :opaque m}
+                            (atake test-scan c))))
+                  (let [c (store/store-scan test-scan s @n "b" "c")
+                        m @n]
+                    (and (e n (atake test-scan c)
+                            {:status :ok, :opaque m}
+                            (atake test-scan c))))
+                  (let [c (store/store-scan test-scan s @n "b" "z")
+                        m @n]
+                    (and (e n (atake test-scan c)
+                            {:status :part, :opaque m, :key "c", :sq 2, :val "C"}
                             nil)
                          (e n (atake test-scan c)
                             {:status :ok, :opaque m}


using nested path

using nested path

--- src/celestial/config.clj
+++ src/celestial/config.clj
@@ -62,7 +62,7 @@
     (validate! c (combine base-v celestial-v (if proxmox proxmox-v {}) (if aws aws-v {}) (if vcenter vcenter-v {})))))

 (def config-paths
-  ["/etc/celestial.edn" (<< "~(System/getProperty \"user.home\")/.celestial.edn")])
+  ["/etc/celestial/celestial.edn" (<< "~(System/getProperty \"user.home\")/.celestial.edn")])

 (def path
   (first (filter #(.exists (file %)) config-paths)))


indenting

indenting

--- src/celestial/launch.clj
+++ src/celestial/launch.clj
@@ -79,7 +79,7 @@
   (start-all components)
   (info (slurp (resource "main/resources/celestial.txt")))
   (info (<<  "version ~{version} see http://celestial-ops.com"))
-  components
+   components
   )

 (defn stop


Return DB connection pool state to enable tools.namespace workflow.

--- src/clj/aspire/sqldb.clj
+++ src/clj/aspire/sqldb.clj
@@ -14,7 +14,9 @@
             [clojure.string :refer [split]]))

 (defn default-connection! [db]
-  (kdb/default-connection (kdb/delay-pool db)))
+  (let [pool (kdb/delay-pool db)]
+    (kdb/default-connection pool)
+    pool))

 (def query-results-types
   {"SELECT" :results


add ssl websockets

add ssl websockets

--- src/cljs/ceres/core.cljs
+++ src/cljs/ceres/core.cljs
@@ -12,8 +12,9 @@

 (enable-console-print!)

+(def uri (goog.Uri. js/document.URL))

-(def uri (goog.Uri. js/document.URL))
+(def ssl? (= (.getScheme uri) "https"))

 (println "Greetings commander")

@@ -35,6 +36,7 @@
 #_(fw/watch-and-reload
   ;; :websocket-url "ws://localhost:3449/figwheel-ws" default
  :jsload-callback (fn [] (print "reloaded"))) ;; optional callback
+

 (defsnippet tweet-item "templates/main.html" [:.tweet-item]
@@ -70,7 +72,13 @@
     om/IWillMount
     (will-mount [_]
       (go
-        (let [connection (<! (connect! (str "ws://" (.getDomain uri) ":" (.getPort uri) "/tweets/ws")))]
+        (let [connection (<! (connect!
+                              (str
+                               (if ssl?  "wss://" "ws://")
+                               (.getDomain uri)
+                               ":" (.getPort uri)
+                               "/tweets/ws")
+                              ))]
             (om/set-state! owner :ws-in (:in connection))
             (om/set-state! owner :ws-out (:out connection))
             (>! (:in connection) {:topic :greeting :data ""})


Maintain focus on input

Maintain focus on input

--- src/cljs/notes/core.cljs
+++ src/cljs/notes/core.cljs
@@ -101,11 +101,21 @@
     nil
     )))

+(defn focus-on-input [] (-> js/document (.querySelector "input") (.focus)))
+
 (defn list-view [app owner]
   (reify
     om/IInitState
     (init-state [_]
       {:delete (chan)})
+    om/IDidMount
+    (did-mount [this]
+      (focus-on-input)
+    )
+    om/IDidUpdate
+    (did-update [this prev-props prev-state]
+      (focus-on-input)
+    )
     om/IWillMount
     (will-mount [_]
       (let [delete (om/get-state owner :delete)]


Use react's get-initial-state for potoo list

--- src/cljs/potoo/core.cljs
+++ src/cljs/potoo/core.cljs
@@ -11,19 +11,23 @@
      [:span (str text ", " name ", " date)]]))

 (defn potoo-list []
-  (fn []
-    (GET "/api/potoos" {:keywords? true
-                        :response-format :json
-                        :handler #(swap! app-state assoc :potoos %)})
-    [:div
-     [:h1 "Potooooooos!"]
-     [:ul
-      (for [p (:potoos @app-state)]
-        ^{:key p} [potoo p])]]))
+  [:div
+   [:h1 "Potooooooos!"]
+   [:ul
+    (for [p (:potoos @app-state)]
+      ^{:key p} [potoo p])]])
+
+(def potoo-list-initial
+  (with-meta potoo-list
+    {:get-initial-state
+     (fn [_]
+       (GET "/api/potoos" {:keywords? true
+                           :response-format :json
+                           :handler #(swap! app-state assoc :potoos %)}))}))

 (defn ^:export run []
   (r/render
-    [potoo-list]
+    [potoo-list-initial]
     (js/document.getElementById "app")))

 (run)


Experiment more with meta-errors

Experiment more with meta-errors

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -435,7 +435,7 @@
                          (= e (max p1e p2e)) 3
                          :else 4)))
                 (vec (repeat (count (:errors ind)) 5)))
-              (if (and (:parent1-errors ind) (:parent2-errors ind))
+              #_(if (and (:parent1-errors ind) (:parent2-errors ind))
                 (vec (for [[e p1e p2e] (mapv #(vector %1 %2 %3)
                                              (:errors ind)
                                              (:parent1-errors ind)
@@ -485,6 +485,19 @@
                          (< e (max p1e p2e)) 2
                          (= e (max p1e p2e)) 5
                          :else 4)))
+                (vec (repeat (count (:errors ind)) 6)))
+              (if (and (:parent1-errors ind) (:parent2-errors ind))
+                (vec (for [[e p1e p2e] (mapv #(vector %1 %2 %3)
+                                             (:errors ind)
+                                             (:parent1-errors ind)
+                                             (:parent2-errors ind))]
+                       (cond
+                         (zero? e) 0
+                         (< e (min p1e p2e)) 1
+                         (and (not= p1e p2e) (= e (min p1e p2e))) 2
+                         (< e (max p1e p2e)) 3
+                         (= e (max p1e p2e)) 4
+                         :else 5)))
                 (vec (repeat (count (:errors ind)) 6)))
               ;
               (= cat :error-neglect)


Add :no-genesis meta-error

Add :no-genesis meta-error

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -1254,12 +1254,13 @@
                 0
                 1)
               ;
-              (= cat :static-size)
-              (if (:parent1-genome ind)
-                (if (= (count (:genome ind))
-                       (count (:parent1-genome ind)))
-                  1
-                  0)
+              (= cat :no-genesis)
+              (if (some (fn [instruction-map]
+                          (and (not (:silent instruction-map))
+                               (some #{(:instruction instruction-map)}
+                                     #{'genome_genesis})))
+                        (:genome ind))
+                0
                 1)
               ;
               (= cat :static-instruction-set)


Added :discounted-total-error-new-best-ratio.

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -101,6 +101,27 @@
                                                           (rest remaining))
                                                 1
                                                 0))))))))
+                          ;
+                          (= cat :discounted-total-error-new-best-ratio)
+                          (if (not (:print-history argmap))
+                            (throw
+                              (Exception.
+                                ":print-history must be true for :discounted-total-error-new-best-ratio"))
+                            (let [hist (:history ind)]
+                              (if (empty? (rest hist))
+                                1000000
+                                (loop [remaining hist
+                                       new-best-count 0
+                                       scale 1]
+                                  (if (empty? (rest remaining))
+                                    (- 1.0 (/ new-best-count (dec (count hist))))
+                                    (recur (rest remaining)
+                                           (+ new-best-count
+                                              (if (every? #(> % (first remaining))
+                                                          (rest remaining))
+                                                (/ 1 scale)
+                                                0))
+                                           (inc scale)))))))
                           ;
                           (= cat :reproductive-fidelity)
                           (let [g (:genome ind)]


Require clojure.java.jdbc in db namespace.

--- src/philly_show_checker/server/db.clj
+++ src/philly_show_checker/server/db.clj
@@ -1,4 +1,5 @@
-(ns philly-show-checker.server.db)
+(ns philly-show-checker.server.db
+  (:require [clojure.java.jdbc :as jdbc]))

 (defn store-scraper-results
   [results]


decrease tweet length

decrease tweet length

--- markov-clj/src/markov_clj/markov.clj
+++ markov-clj/src/markov_clj/markov.clj
@@ -62,7 +62,7 @@
   (let [seed (choose-seed database)]
     (loop [{word :word :as prefix-map} {:word :head :prefix seed}
            words [(last seed)]]
-      (if (or (= :tail word) (< 120 (count (apply str words))))
+      (if (or (= :tail word) (< 110 (count (apply str words))))
         words
         (recur (next-word database prefix-map) (conj words word))))))


Remove redundant `malli.core/walk` call

Remove redundant `malli.core/walk` call

--- examples/ring-malli-swagger/src/example/server.clj
+++ examples/ring-malli-swagger/src/example/server.clj
@@ -21,10 +21,6 @@
 (def sample-request
   [:map {:registry {::age [:and int? [:> 18]]}}
    [:age ::age]])
-
-(malli.core/walk
-  (malli.core/schema sample-request)
-  (malli.core/schema-walker identity))

 (defn handle [request]
   (prn (:parameters request))


Added some query variable validation

Added some query variable validation

--- src/graphql_clj/query_validator.clj
+++ src/graphql_clj/query_validator.clj
@@ -19,6 +19,17 @@
   (case (:tag type)
     :basic-type (:name type)
     :list-type (recur (:inner-type type))))
+
+(defn- type-string
+  ([type] (.toString (type-string (StringBuilder.) type)))
+  ([^StringBuilder buf type]
+   (case (:tag type)
+     :basic-type (.append buf (:name type))
+     :list-type (-> buf
+                    (.append \[)
+                    (type-string (:inner-type type))
+                    (.append \])))
+   (if (:required type) (.append buf \!) buf)))

 (defn- get-root [schema def]
   (get (:roots schema) (if (= :mutation-definition (:tag def)) :mutation :query)))
@@ -93,11 +104,22 @@

 (declare check-selection-set)

+(defn- check-argument [a {:keys [name value] :as arg}]
+  ;; (println "ARG:" arg)
+  (case (:tag value)
+    :variable-reference (update a :var-use conj name)
+    a))
+
+(defn- check-arguments [a {argdecls :arguments :as fdecl} {args :arguments :as f}]
+  (if (and (nil? argdecls) (nil? args))
+    a ;; common case
+    (reduce check-argument a args)))
+
 (defn- check-field [tdef field-map a f]
   (case (:tag f)
     :selection-field
     (if-let [fdecl (field-map (:name f))]
-      (let [[errors f] (check-selection-set (base-type (:type fdecl)) a (assoc f :resolved-type (:type fdecl)))]
+      (let [[errors f] (check-selection-set (base-type (:type fdecl)) (check-arguments a fdecl f) (assoc f :resolved-type (:type fdecl)))]
         (-> (assoc a :errors errors)
             (update :vfields conj f)))
       (if (:alias f)
@@ -124,6 +146,63 @@
           a (reduce (partial check-field tdef field-map) (assoc a :vfields []) sset)]
       [(:errors a) (assoc def :selection-set (:vfields a))])
     [(:errors a) def]))
+
+(defn- coersable [t v]
+  (case (:tag t)
+    :basic-type
+    (case (:tag v)
+      :boolean-value (= 'Boolean (:name t))
+      :int-value     (#{'Int 'Float} (:name t))
+      :float-value   (= 'Float (:name t))
+      :string-value  (= 'String (:name t))
+      :null-value    (not (:required t))
+      :enum-value    true ;; TODO
+      :list-value    false
+      :object-value  true)
+
+    :list-type
+    (case (:tag v)
+      ;; TODO: provide error and location for each mismatch
+      :list-value (every? (partial coersable (:inner-type t)) (:values v))
+      :null-value (not (:required t))
+      false)))
+
+(defn- valid-variable-type? [schema tdecl]
+  (#{:scalar-definition :enum-definition :input-definition} (:tag tdecl)))
+
+(defn- map-var-decl [{:keys [schema] :as a} {:keys [name type default-value] :as v}]
+  (let [btype (base-type type)
+        tdecl (get-in schema [:type-map btype])]
+    (cond
+      (nil? tdecl)
+      (update a :errors err type "variable '$%s' type '%s' is not defined" name btype)
+
+      ;; TODO: can we give a more helpful message here--let the caller know that only scalar, enum, and input types are allowed.
+      (not (valid-variable-type? schema tdecl))
+      (update a :errors err v "variable '$%s' type '%s' is not a valid input type" name (type-string type))
+
+      (contains? (:var-map a) name)
+      (update a :errors err v "variable '$%s' is already declared" name)
+
+      :else
+      (or (and default-value
+               (cond
+                 (:required type)
+                 (-> (update a :errors err v "variable '$%s' is required, and thus cannot have a default value" name)
+                     (update :var-map assoc name (dissoc v :default-value)))
+
+                 (= :variable-reference (:tag default-value))
+                 (-> (update a :errors err default-value "variable default value must be constant")
+                     (update :var-map assoc name (dissoc v :default-value)))
+
+                 (not (coersable type default-value))
+                 (-> (update a :errors err v "variable '$%s' has a default value that cannot be coersed to its declared type" name)
+                     (update :var-map assoc name (dissoc v :default-value)))))
+
+          (update a :var-map assoc name v)))))
+
+(defn- map-var-decls [a def]
+  (reduce map-var-decl (assoc a :var-map {} :var-use #{}) (:variable-definitions def)))

 (defn- check-definition [a def]
   (case (:tag def)
@@ -138,7 +217,7 @@
     (if (contains? (:def-map a) (:name def))
       ;; 5.1.1.1 operation name uniqueness
       (update a :errors err (:name def) "operation with name '%s' is already declared" (:name def))
-      (let [[errors def] (check-selection-set (get-root (:schema a) def) a def)]
+      (let [[errors def] (check-selection-set (get-root (:schema a) def) (map-var-decls a def) def)]
         (-> (assoc a :errors errors)
             (update :def-map assoc (:name def) def)
             (update :query conj def))))


Optimize code in 'config.clj'

Optimize code in 'config.clj'

--- src/org/spootnik/cyanite/config.clj
+++ src/org/spootnik/cyanite/config.clj
@@ -149,23 +149,12 @@
     (info "Loading blacklist rules from: " path)
     (doseq [[k v] (parse-string (slurp path) false)] (set-blacklist-patterns! k v))))

-(defn config-store-cache
-  [config]
-  (let [store (get config :store)
-        settings (merge default-store-cache {:store store})]
+(defn config-with-deps
+  [config entity default deps]
+  (let [settings (merge default (select-keys config deps))]
     (-> config
-        (update-in [:store-cache] (partial merge settings))
-        (update-in [:store-cache] get-instance :store-cache))))
-
-(defn config-store-middleware
-  [config]
-  (let [store (get config :store)
-        cache (get config :cache)
-        settings (merge default-store-middleware {:store store
-                                                  :cache cache})]
-    (-> config
-        (update-in [:store-middleware] (partial merge settings))
-        (update-in [:store-middleware] get-instance :store-middleware))))
+        (update-in [entity] (partial merge settings))
+        (update-in [entity] get-instance entity))))

 (defn init
   "Parse yaml then enhance config"
@@ -179,8 +168,9 @@
         (update-in [:stats] (partial merge default-stats))
         (update-in [:store] (partial merge default-store))
         (update-in [:store] get-instance :store)
-        (config-store-cache)
-        (config-store-middleware)
+        (config-with-deps :store-cache default-store-cache [:store])
+        (config-with-deps :store-middleware default-store-middleware
+                          [:store :cache])
         (update-in [:carbon] (partial merge default-carbon))
         (update-in [:carbon :rollups] convert-shorthand-rollups)
         (update-in [:carbon :rollups] assoc-rollup-to)


update service image in catalog metadata

Signed-off-by: Tim Labeeuw <75a28b1800083e870fa749fd9d79d5b1b61ab71c@pivotal.io>

--- src/rabbitmq-broker/src/clojure/io/pivotal/pcf/rabbitmq/config.clj
+++ src/rabbitmq-broker/src/clojure/io/pivotal/pcf/rabbitmq/config.clj
@@ -108,7 +108,7 @@
   (let [svs           (get m :service)
         long-desc     "RabbitMQ is a robust and scalable high-performance multi-protocol messaging broker."
         ;; displayed in Console
-        img-url       "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAA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/3wzCANSPAsMyB6OGFY2Otfz1QB2h1hyBEDkv/MEvj2Jx8uQ2ldIivGbZ4ffvOXyhFjzfjg0mx32BqB88xxRZi/9pvPbnu757q366+98o3VV9PT/nf1avWlzcDjYT/oz/5y/Lz1u4e9c6VX5T/fb1/VwsWHtX+W897/R+WJ/agDXlMJpQ7qo5N5pQeLhxJ61dAj43efrM5AEgZqsWKIcN6tYJ603YbbQse0I5A6PUxvFcM4ct2B2MA+oaORkYwHj2fUCncbQg9O3b/Qd6/UfEPf9dMcRD7BJJ1uf58SF+6K7jbrG8wRgpSeaMx7n/gn//JSG/M2YRfottEYOIP0wC0CZTihRujKoVFQkQCCMk7OdSjcihI4OSVnsp71McKP2sAzdcHkBZgFmEujR8fefuhr+8v9+j4daO6AKIHTCrCvIJGxtGoCIjNRzya5ot0cCbEHp8GsLERTEc/J5QHuxHDDFA05PTddXn+yXjWKKEB1DUBiH/SFyMgVcJXai7UUJ8GQCOg8AkNgEZA4RMaQLtmMK5SXCwMgKJicY8GYMEIRuKIYIwXwwkWlC7u5XkpaAA2jSAXG8E404NEwvz5WPhFXg4aQNJmgGjgCKMCK739m2neh48G4LcRZGMTQGQwzAtihILSRb0FFvVoAGlLEWAGh1SKVyEmBPL5M7HoGeLTALyJDA7Gz6wZrM/pEdafY09PAwjBEIarDCHU6CBfJfgCGwUNIGRDGIlrBgfj55xn37AY5/Lnys8csqMBkE1ThuE4OngpNoS0FBULseAvx718gSE9DYCYSx2ysTHsqDIF22lEvkrsd+PflxjK0wBIsgaRq0ofsgaihoJa2169yIq8X/y/AAMAO5spKVdCG6AAAAAASUVORK5CYII="
         provider-name "Pivotal"]
     {:id          service-uuid
      :name        "p-rabbitmq"


(maint) Remove clojure.test require from core ns.

Seriously, wut?

--- src/puppetlabs/kitchensink/core.clj
+++ src/puppetlabs/kitchensink/core.clj
@@ -8,8 +8,7 @@
   (:import [org.ini4j Ini Config BasicProfileSection]
            [javax.naming.ldap LdapName]
            [java.io StringWriter Reader File])
-  (:require [clojure.test]
-            [clojure.tools.logging :as log]
+  (:require [clojure.tools.logging :as log]
             [clojure.string :as string]
             [clojure.tools.cli :as cli]
             [clojure.java.io :as io]


added todo for checkbox

added todo for checkbox

--- src/main/untangled/ui/elements.cljc
+++ src/main/untangled/ui/elements.cljc
@@ -237,7 +237,9 @@

   `:className` - additional class stylings to apply to the top level of the checkbox
   `:id` string - Name of the checkbox
-  `:style` :none (default), :indeterminate
+
+  TODO:
+  `:checked` - true, false, or :partial
   "
   [{:keys [id style] :or {id ""} :as attrs}]
   (let [legal-styles #{:indeterminate}


Fix misplaced doall

Fix misplaced doall

--- src/rdf_path_examples/evaluation.clj
+++ src/rdf_path_examples/evaluation.clj
@@ -57,7 +57,7 @@
                                                   clj->rdf-model
                                                   (partial generate-fn path))))
         avg-ild-fn (fn [[path-name path] index]
-                     (let [avg-ild (try (doall (average (repeatedly-generate-fn path index)))
+                     (let [avg-ild (try (average (doall (repeatedly-generate-fn path index)))
                                         (catch Exception ex
                                           (log/error (.getMessage ex))
                                           :failed))]


Preserve mouse position relative to the element

--- src-cljs/om-data-vis/widget.cljs
+++ src-cljs/om-data-vis/widget.cljs
@@ -10,19 +10,22 @@

 (defn handle-drag-event [cursor owner evt-type e]
   (when (= evt-type :down)
-    (om/set-state! owner :pressed true))
+    (om/set-state! owner :mouse {:offset-top (.-offsetY e)
+                                 :offset-left (.-offsetX e)
+                                 :pressed true}))
   (when (= evt-type :up)
-    (om/set-state! owner :pressed false))
-  (when (and (= evt-type :move) (om/get-state owner :pressed))
-    (om/update! cursor :position {:top (.-clientY e) :left (.-clientX e)})))
-
+    (om/set-state! owner [:mouse :pressed] false))
+  (when (and (= evt-type :move) (om/get-state owner [:mouse :pressed]))
+    (let [{:keys [offset-top offset-left]} (om/get-state owner :mouse)]
+      (om/update! cursor :position {:top (- (.-clientY e) offset-top)
+                                    :left (- (.-clientX e) offset-left)}))))

 (defn draggable [cursor owner {:keys [build-fn id]}]
   (reify
     om/IInitState
     (init-state [_]
       {:mouse-chan (chan (sliding-buffer 1000))
-       :pressed false})
+       :mouse {:offset-top 0 :offset-left 0 :pressed false}})
     om/IWillMount
     (will-mount [_]
       (let [mouse-chan (om/get-state owner :mouse-chan)]
@@ -42,6 +45,6 @@
       (html
        (let [{:keys [top left]} (:position cursor)]
          [:div {:id id
-                :style {:top (str (- top 40) "px") :left (str (- left 40) "px")
+                :style {:top (str top "px") :left (str left "px")
                         :position "absolute" :z-index 100}}
           build-fn])))))


Added docstrings and made some functions namespace private

--- src/templater/grafter/rdf/preview.clj
+++ src/templater/grafter/rdf/preview.clj
@@ -11,7 +11,13 @@
   (symbolize-keys (merge (select-keys row-data (map (comp keyword name) (:keys bindings)))
                          (select-keys row-data (map name (:strs bindings))))))

-(defmulti templatable? class)
+(defmulti ^:private templatable?
+  "Predicate that returns true if the supplied argument should be emitted when
+  attempting to inline global vars in a graph template.
+
+  Used with bind-constants."
+
+  class)

 (defmethod templatable? nil [v] true)

@@ -23,18 +29,12 @@

 (defmethod templatable? clojure.lang.Keyword [v] true)

-(defn- bind-constants [ns form]
-  (comment
-    (z/root (walk/prewalk form (fn [n]
-                                 (let [s (z/sexpr n)]
-                                   (if (and (symbol? s)
-                                            (ns-resolve ns s))
-                                     (when-let [varr (get (ns-map ns) s)]
-                                       (when (templatable? @varr)
-                                         (z/replace n @varr)))
-                                     n))))))
+(defn- bind-constants
+  "Walks the given form and resolves symbols from the namespace to their vars,
+  returning the values they reference if they are templatable?.

-  ;; TODO replace above with this
+  Non templatable values are unexpanded/uninlined and left as symbols."
+  [ns form]
   (clojure.walk/postwalk
    (fn [f]
      (if (and (symbol? f)
@@ -44,8 +44,7 @@
            @varr
            f)
          f)
-       f)
-     ) form))
+       f)) form))

 (defrecord UnreadableForm [form-string form-class])

@@ -112,6 +111,4 @@
                                          [b c]])
                                  (graph a [a [b c]]))))

-  (preview-graph ds my-template 0)
-
-  )
+  (preview-graph ds my-template 0))


(PDB-3993) command-service: guard resource cleanup in stop method

Make sure resources that don't exist until the start method has
finished are only cleaned up if they exist.

--- src/puppetlabs/puppetdb/command.clj
+++ src/puppetlabs/puppetdb/command.clj
@@ -653,10 +653,9 @@
              :consumer-threadpool command-threadpool)))

   (stop [this {:keys [consumer-threadpool command-chan delay-pool] :as context}]
-    (async/close! command-chan)
-    (gtp/shutdown consumer-threadpool)
-    (when delay-pool
-      (stop-and-reset-pool! delay-pool))
+    (some-> command-chan async/close!)
+    (some-> consumer-threadpool gtp/shutdown)
+    (some-> delay-pool stop-and-reset-pool!)
     (async/unsub-all (:response-pub context))
     (async/untap-all (:response-mult context))
     (async/close! (:response-chan-for-pub context))


Add some more tests.

Add some more tests.

--- test/fhofherr/clj_db_util/jdbc_template_test.clj
+++ test/fhofherr/clj_db_util/jdbc_template_test.clj
@@ -71,7 +71,21 @@
         (is (nil? (tx-exec test-db/*db*
                            (t/query stmt
                                         :params {:number 2}
-                                        :result-set-fn first))))))
+                                        :result-set-fn first)))))
+
+      (let [stmt "SELECT :v AS result FROM DUAL"]
+        (is (= {:result 1}
+               (tx-exec test-db/*db*
+                        (t/query stmt
+                                 :params {:v 1}
+                                 :result-set-fn first)))))
+
+      (let [stmt "SELECT cast(:v as int) AS result FROM DUAL"]
+        (is (= {:result 1}
+               (tx-exec test-db/*db*
+                        (t/query stmt
+                                 :params {:v 1}
+                                 :result-set-fn first))))))

     (testing "subselects"


separate go-loops / subs for console and command loading

--- src/replme/cljs/loading_mesage.cljs
+++ src/replme/cljs/loading_mesage.cljs
@@ -15,11 +15,16 @@
   (scroll-to-bottom $container))

 (defn init [socket-out-pub]
-  (let [socket-out-sub (sub socket-out-pub :console (chan))
+  (let [console-out-sub (sub socket-out-pub :console (chan))
+        command-out-sub (sub socket-out-pub :command (chan))
         loading-spinner ($ :#clojure-spinner)
         loading-message ($ :#loading-message)]
-    (go-loop [msg (<! socket-out-sub)]
-      (if (= msg "REPL OK")  ;; TODO: listen to :command channel for repl ok, this no longer receives repl ok
-        (fade-out loading-spinner 500)
-        (append-text-to-container loading-message msg))
-      (recur (<! socket-out-sub)))))
+
+    (go-loop [msg (<! command-out-sub)]
+             (if (= (:message msg) "REPL OK")
+               (fade-out loading-spinner 500))
+             (recur (<! command-out-sub)))
+
+    (go-loop [msg (<! console-out-sub)]
+             (append-text-to-container loading-message msg)
+             (recur (<! console-out-sub)))))


fix navigation default options overwrite (#13378)

--- src/status_im/navigation2/core.cljs
+++ src/status_im/navigation2/core.cljs
@@ -11,8 +11,8 @@
                   :wallet      2
                   :browser     3})

-(defonce set-navigation-default-options
-  (.setDefaultOptions Navigation (clj->js {:options {:topBar {:visible false}}})))
+;; (defonce set-navigation-default-options
+;;   (.setDefaultOptions Navigation (clj->js {:options {:topBar {:visible false}}})))

 ;; TODO (parvesh) - improve open-modal and close-modal
 (defn open-modal [comp]


CMR-809: Added additional tests for NEAR_REAL_TIME aliasing.

--- test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -104,9 +104,12 @@

            ;; collection data type aliases for NEAR_REAL_TIME
            "NEAR_REAL_TIME" [coll22]
+           "NRT" [coll22]
            "near_real_time" [coll22]
            "nrt" [coll22]
            "near-real-time" [coll22]
+           "near real-time" [coll22]
+           "near-real time" [coll22]

            ;; summary
            "summary" [coll15]
@@ -210,7 +213,9 @@
            "A*C" [coll2 coll5 coll21]
            "XY*" [coll2 coll13]
            "*aser" [coll5 coll7 coll9 coll14]
-           "p*ce" [coll6]))
+           "p*ce" [coll6]
+           "NEA*REA*IME" [coll22]
+           "nea*rea*ime" [coll22]))
     (testing "search by keywords using wildcard ?."
       (are [keyword-str items]
            (let [refs (search/find-refs :collection {:keyword keyword-str})
@@ -222,7 +227,9 @@
            "A?C" [coll2 coll5 coll21]
            "XY?" [coll2 coll13]
            "?aser" [coll5 coll7 coll9 coll14]
-           "p*ace" [coll6]))
+           "p*ace" [coll6]
+           "NEAR?REAL?TIME" [coll22]
+           "near?real?time" [coll22]))
     (testing "sorted search by keywords."
       (are [keyword-str items]
            (let [refs (search/find-refs :collection {:keyword keyword-str})


CMR-387: Removed unneeded test.

CMR-387: Removed unneeded test.

--- test/cmr/system_int_test/search/collection_spatial_search_test.clj
+++ test/cmr/system_int_test/search/collection_spatial_search_test.clj
@@ -111,19 +111,6 @@
         am-point (make-coll :geodetic nil "am-point" (p/point 180 22))]
     (index/refresh-elastic-index)

-    (testing "orbit parameters retrieval"
-      (let [found (search/find-concepts-in-format
-                    "application/echo10+xml"
-                    :collection
-                    {:entry-title "orbit-params"})
-            xml (:body found)
-            echo10 (re-find #"<Collection>.*Collection>" xml)
-            umm (ec/parse-collection echo10)
-            umm-op (:orbit-parameters (:spatial-coverage umm))
-            expected (c/map->OrbitParameters orbit-params)]
-        (= expected umm-op)))
-
-
     (testing "line searches"
       (are [ords items]
            (let [found (search/find-refs


Hack for clojure 1.4 broke test under 1.8

--- test/implementation/line_numbers/fim_deftest.clj
+++ test/implementation/line_numbers/fim_deftest.clj
@@ -7,13 +7,11 @@
             [midje.config :as config]))

 (deftest fails
-  ;; For some reason, clojure.test runs in an environment without the right binding for *file*
-  (binding [*file* "NO_SOURCE_PATH"]
-    (state/with-isolated-output-counters ; we only want the output
-      (fact (+ 1 1) => 3))))
+  (state/with-isolated-output-counters ; we only want the output
+    (fact (+ 1 1) => 3)))

-(future-fact "In clojure 1.8, a fact within `deftest` no longer gets the line number right"
+(fact "In clojure 1.8, a fact within `deftest` no longer gets the filename right"
   (let [test-result (ctf/run-tests [*ns*])]
-    (:lines test-result) => (contains #"fim_deftest.clj:13")))
+    (:lines test-result) => (contains #"fim_deftest.clj:11")))

 (alter-meta! #'fails dissoc :test) ;; To keep from spewing failure output


always allow nil origin.

always allow nil origin.

--- src/wombats/components/pedestal.clj
+++ src/wombats/components/pedestal.clj
@@ -18,8 +18,9 @@
   [origin]
   ;; TODO: #368 Remove this once we do some testing
   (log/info origin)
-  (let [match (re-find #"^$|\.wombats\.io$|\/\/wombats\.io$" origin)]
-    (some? match)))
+  (if origin
+    (some? (re-find #"^$|\.wombats\.io$|\/\/wombats\.io$" origin))
+    true))

 (defn- create-service-map
   [config service]


these are not sentences

these are not sentences

--- src/cake/tasks/test.clj
+++ src/cake/tasks/test.clj
@@ -101,12 +101,12 @@
   (doseq [{:keys [name output] :as test} tests :when output]
     (printfs [:yellow] (str "cake test " ns "/" name))
     (dorun (map report! output)))
-  (printfs [] "Ran %s tests containing %s assertions in %.2fs."
+  (printfs [] "Ran %s tests containing %s assertions in %.2fs"
            (:test      count 0)
            (:assertion count 0)
            (/ (:time count) 1000.0))
   (printfs (colorize count)
-           "%s failures, %s errors."
+           "%s failures, %s errors"
            (:fail  count 0)
            (:error count 0))
   (printfs [:underline] (apply str (repeat 40 " ")))
@@ -156,18 +156,18 @@
                                                (for [[ns tests] (test-vars opts) :when (seq tests)]
                                                  (parse-results ns (bake-invoke run-ns-tests ns tests)))))]
                (if (< 0 (:test count 0))
-                 (do (printfs [] "Ran %d tests in %d namespaces, containing %d assertions, in %.2fs (%.2fs real)."
+                 (do (printfs [] "Ran %d tests in %d namespaces, containing %d assertions, in %.2fs (%.2fs real)"
                               (:test      count 0)
                               (:ns        count 0)
                               (:assertion count 0)
                               (/ (:time count) 1000.0)
                               (/ real-time     1000.0))
                      (printfs (colorize count)
-                              "%d OK, %d failures, %d errors."
+                              "%d OK, %d failures, %d errors"
                               (:pass  count 0)
                               (:fail  count 0)
                               (:error count 0)))
-                 (printfs [:red] "No tests matched arguments."))))))
+                 (printfs [:red] "No tests matched arguments"))))))

 (deftask test #{compile-java}
   "Run project tests."


Update neanderthal dependency in benchmarks to 0.17.2.

--- examples/benchmarks/project.clj
+++ examples/benchmarks/project.clj
@@ -1,4 +1,4 @@
-(defproject benchmarks "0.15.0-SNAPSHOT"
+(defproject benchmarks "0.17.2"
   :description "Benchmarks and comparisons between Neanderthal and other Java matrix libraries."
   :url "https://github.com/uncomplicate/neanderthal/tree/master/examples/benchmarks"
   :license {:name "Eclipse Public License"
@@ -12,10 +12,10 @@
                  [net.mikera/vectorz-clj "0.46.0"]
                  [clatrix/clatrix "0.5.0"]
                  [uncomplicate/fluokitten "0.6.0"]
-                 [uncomplicate/neanderthal "0.15.0"]
-                 [hswick/jutsu.matrix "0.0.11"]
-                 [org.nd4j/nd4j-api "0.9.0"]
-                 [org.nd4j/nd4j-cuda-8.0 "0.9.0"]]
+                 [uncomplicate/neanderthal "0.17.2"]
+                 #_[hswick/jutsu.matrix "0.0.11"]
+                 #_[org.nd4j/nd4j-api "0.9.0"]
+                 #_[org.nd4j/nd4j-cuda-8.0 "0.9.0"]]

   :jvm-opts ^:replace ["-Dserver -Dclojure.compiler.direct-linking=true"
                        "-XX:MaxDirectMemorySize=16g" "-XX:+UseLargePages"]


add stub view link.

add stub view link.

--- src-cljs/kixi/hecuba/widgets/map.cljs
+++ src-cljs/kixi/hecuba/widgets/map.cljs
@@ -26,11 +26,12 @@

 ;; TODO I want to build the html using sablono, but it doesn't seem to play nice with leaflet.addMarker().
 ;;      solutions from YOU! dear reader are most welcome.
-(defn build-popup [owner {:keys [property_data name photos] :as e}]
+(defn build-popup [owner {:keys [id,property_data name photos] :as e}]
   (let [{:keys [address_street address_street_two address_region address_country description tech-icons]} property_data
         full-address (str/join ", " [address_street address_street_two address_region address_country])
         title address_street ;; TODO what should go here?
         img-url (first photos)
+        entity-url "/app"
         tech-icons (apply str (for [i (:technology_icons property_data) :when i]
                                 (str "

")))]
     (str "

@@ -44,6 +45,7 @@

+                        view

                       " full-address "


Fixed broken URL reading bug

Fixed broken URL reading bug

--- src/cheating_countdown/core.cljs
+++ src/cheating_countdown/core.cljs
@@ -72,15 +72,14 @@
     (reset! app-state (last @app-history))
     (reset-dom-elements (last @app-history))))

-
 ;;Read deadline from URL
 (def deadline (.getParameterValue (Uri. (.-location js/window)) "date"))

 ;;Helper to update deadline with new value
 (defn update-deadline
-  [app new-deadline]
+  [app deadline new-deadline]
   (do
-    (-> (js/jQuery "#deadline-display") (.html (:deadline @app)))
+    (-> (js/jQuery "#deadline-display") (.html deadline))
     (om/update! app :deadline new-deadline)))

 ;;Display code for timer component
@@ -97,14 +96,14 @@
     om/IWillMount
     (will-mount [_]
       ;;If URL has a deadline update state to that deadline
-      (when (not= deadline nil) (update-deadline app deadline))
+      (when (not= deadline nil) (update-deadline app (:deadline app) deadline))

       ;;Infinite go loop that reads from deadline-chan when there's a
       ;; click event and updates deadline
       (let [deadline-chan (om/get-state owner :deadline-chan)]
         (go (while true (let [new-deadline (<! deadline-chan) ]
                             (when (not= nil new-deadline)
-                               (update-deadline app new-deadline))))))
+                               (update-deadline app (:deadline @app) new-deadline))))))

       ;;Update remaining time in the app state every one second.
       (om/set-state! owner :interval


msg div

msg div

--- src/checkmate/views/new_list.clj
+++ src/checkmate/views/new_list.clj
@@ -30,6 +30,7 @@
   {:body
    [:div
     [:h3 "Create a new checklist"]
+    [:div.row#msg]
     [:div.row
      [:div.col-md-12
       (render-form)]]]


Add proper stats for runs

Add proper stats for runs

--- src/constraint/core.cljs
+++ src/constraint/core.cljs
@@ -15,6 +15,8 @@
     [big-bang.core :refer [big-bang!]]
     [cljs.reader :as reader]
     [goog.net.XhrIo :as xhr]
+    [goog.string :as gstring]
+    [goog.string.format]
     [cljs.core.async :as async :refer [<! chan close!]]))

@@ -145,7 +147,7 @@
   [{:keys [initial length lengths stats random?]}]
   (merge initial
          {:lengths lengths,
-          :length length
+          :length 0
           :stats stats,
           :random? random?,
           :initial initial}))
@@ -233,18 +235,55 @@
    (some true?)))

+(defn make-coords-map-for-js
+  [x y]
+  {"color" (if (pos? y) "blue" "red")
+   "x"     x
+   "y"     (Math/abs y)})
+
 (defn make-a-map-for-graph
   [s]
-  (mapv #(let [c (if (pos? %1) "blue" "red")]
-           {"color" c "x" %2 "y" %1 }) (take-last 100 s) (range)))
+  (mapv make-coords-map-for-js (range) (take-last 100 s)))
+
+(defn avg
+  [coll]
+  (if (= 0 (count coll))
+    0.0
+    (/ (apply + coll) (count coll))))
+
+(defn zero-if-empty-apply
+  [f coll]
+  (if (empty? coll)
+    0
+    (apply f coll)))
+
+(defn make-stats-for-js
+  [{:keys [lengths]}]
+  (let [groupped  (merge {true [], false []} (group-by pos? lengths))
+        successes (groupped true)
+        failures  (map #(Math/abs %) (groupped false))]
+    (gstring/format
+     "Runs: %d, win: %d, win max/min: %d/%d, win avg: %.2f\n
+fail: %d, fail max/min: %d/%d, fail avg: %.2f"
+    (count lengths)
+    (count successes)
+    (zero-if-empty-apply max successes)
+    (zero-if-empty-apply min successes)
+    (avg successes)
+    (count failures)
+    (zero-if-empty-apply max failures)
+    (zero-if-empty-apply min failures)
+    (avg failures)
+    )
+  ))

 (defn graph
   [world-state]
   (js/js_graph
-   (clj->js (str (:stats world-state)))
+   (clj->js (str (make-stats-for-js world-state)))
    (clj->js [{"key"    "Series #1",
-                   "values" (make-a-map-for-graph (:lengths world-state))
-                   "color"  "#0000ff"}]))
+              "values" (make-a-map-for-graph (:lengths world-state))
+              "color"  "#0000ff"}]))
   world-state)


Edit edge color.

Edit edge color.

--- src/constraint/core.cljs
+++ src/constraint/core.cljs
@@ -139,9 +139,12 @@

 (defn handle-editing [event world-state]
   (let [clicked-what (event->targetid event)
+        clicked-edge? (re-matches #"edge.*" clicked-what)
         clicked-vertex? (re-matches #"vertex.*" clicked-what)]
     (cond
       (:moving? world-state) (move-the-vertex world-state event)
+      clicked-edge? (update-in world-state [:edges clicked-what 2]
+                               #(if (= :blue %) :red :blue))
       clicked-vertex? (merge world-state {:moving? true
                                           :vertex-moving clicked-what})
       :else world-state)))


[#87] remove 'slingshot' exclusion.

[#87] remove 'slingshot' exclusion.

--- ancient-clj/project.clj
+++ ancient-clj/project.clj
@@ -13,8 +13,7 @@
                  [clj-http "2.1.0"
                   :exclusions [com.cognitect/transit-clj
                                crouton
-                               org.apache.httpcomponents/httpclient
-                               slingshot]]
+                               org.apache.httpcomponents/httpclient]]
                  [commons-logging "1.2"]
                  [joda-time "2.9.2"]
                  [potemkin "0.4.3"]]


Improve event-bus test: Didn't actually check the message content and after that was done, publishing and then starting to subscribe doesn't make for a stable test

--- test/clj/lambdacd/event_bus_test.clj
+++ test/clj/lambdacd/event_bus_test.clj
@@ -24,24 +24,12 @@
       (loop [i 0]
         (if (< i 100)
           (do
-            (async/<! payload)
-            (append-to! received-messages i)
+            (append-to! received-messages (async/<! payload))
             (recur (inc i)))))
       (unsubscribe ctx :foo subscription))))

 (deftest event-bus-test
   (testing "that we can publish, subscribe and unsubscribe"
-    (let [ctx                (initialize-event-bus (some-ctx))
-          published-messages (atom [])
-          received-messages  (atom [])]
-      (publish-200-messages ctx published-messages)
-      (subscribe-read-100-messages-unsubscribe ctx received-messages)
-
-      (is-eventually (= 200 (count @published-messages)))
-      (is-eventually (= 100 (count @received-messages)))
-
-      (is (= (take 100 @published-messages) @received-messages))))
-  (testing "that we can subscribe first, then publish"
     (let [ctx                (initialize-event-bus (some-ctx))
           published-messages (atom [])
           received-messages  (atom [])]


Two tests for function config/get-job-list-url

--- test/emender_jenkins/config_test.clj
+++ test/emender_jenkins/config_test.clj
@@ -495,6 +495,23 @@
             (get-started-on-ms {:configuration nil})               nil
             (get-started-on-ms {:configuration nil})               nil)))

+(deftest test-get-job-list-url-1
+    "Check the behaviour of function emender-jenkins.config/get-job-list-url."
+    (testing "the behaviour of function emender-jenkins.config/get-job-list-url."
+        (are [x y] (= x y)
+            (get-job-list-url {:configuration {:jenkins {:jenkins-job-list-url nil}}}) nil
+            (get-job-list-url {:configuration {:jenkins {:jenkins-job-list-url false}}}) false
+            (get-job-list-url {:configuration {:jenkins {:jenkins-job-list-url true}}}) true
+            (get-job-list-url {:configuration {:jenkins {:jenkins-job-list-url "Queue"}}}) "Queue")))
+
+(deftest test-get-job-list-url-2
+    "Check the behaviour of function emender-jenkins.config/get-job-list-url."
+    (testing "the behaviour of function emender-jenkins.config/get-job-list-url."
+        (are [x y] (= x y)
+            (get-job-list-url {:configuration {:jenkins {:jenkins-job-list-url nil}}}) nil
+            (get-job-list-url {:configuration {:jenkins nil}})                         nil
+            (get-job-list-url {:configuration nil})                                    nil)))
+
 (deftest test-get-in-queue-view-1
     "Check the behaviour of function emender-jenkins.config/get-in-queue-view."
     (testing "the behaviour of function emender-jenkins.config/get-in-queue-view."


NPE test for get-api-part-from-uri function

--- test/emender_jenkins/server_test.clj
+++ test/emender_jenkins/server_test.clj
@@ -115,3 +115,8 @@
             "create_job" (get-api-command "/api/create_job" "/api")
             "system"     (get-api-command "/api/system/banners" "/api"))))

+(deftest test-get-api-part-from-uri-NPE
+    "Check the function emender-jenkins.server/get-api-part-from-uri."
+    (testing "the function emender-jenkins.server/get-api-part-from-uri."
+        (is (thrown? NullPointerException (get-api-part-from-uri nil nil)))))
+


Fix test, should be URI not URL

Fix test, should be URI not URL

--- test/grafter/rdf/repository_test.clj
+++ test/grafter/rdf/repository_test.clj
@@ -119,6 +119,6 @@
          #{}))

   (is (= (into #{} (repo "./test/grafter/1.nt"))
-         #{(->Triple (URL. "http://one")
-                    (URL. "http://lonely")
-                    (URL. "http://triple"))})))
+         #{(->Triple (URI. "http://one")
+                     (URI. "http://lonely")
+                     (URI. "http://triple"))})))


Adding support for validating the m value of a sub-component

--- web-client/test/test_burgerboard/huh.cljs
+++ web-client/test/test_burgerboard/huh.cljs
@@ -13,9 +13,10 @@
   (apply t/do-report args)
   )

-(defn -instrument [sub-component cursor _]
+(defn -instrument [sub-component cursor m]
   {:sub-component sub-component
-   :cursor cursor}
+   :cursor cursor
+   :m m}
   )

 (defn test-predicates
@@ -183,24 +184,32 @@
     )
   )

-(defn sub-component [sub-component cursor]
-  (fn -sub-component-pred [component]
-    (let [expected-name (component-name sub-component)
-          actual-name (component-name (:sub-component component))
-          actual-component @(:cursor component)]
-      (cond
-       (not= sub-component (:sub-component component))
-       {:msg "sub-component does not match"
-        :expected expected-name :actual actual-name}
-
-       (not= cursor actual-component)
-       {:msg (str "sub-component cursor does not match for " expected-name)
-        :expected cursor :actual actual-component}
-
-       :else true
+(defn sub-component
+  ([expected-component cursor] (sub-component expected-component cursor nil))
+  ([expected-component cursor m]
+     (fn -sub-component-pred [component]
+       (let [expected-name (component-name expected-component)
+             actual-name (component-name (:sub-component component))
+             actual-cursor @(:cursor component)
+             actual-m (:m component)]
+         (cond
+          (not= expected-component (:sub-component component))
+          {:msg "sub-component does not match"
+           :expected expected-name :actual actual-name}
+
+          (not= cursor actual-cursor)
+          {:msg (str "sub-component cursor does not match for " expected-name)
+           :expected cursor :actual actual-cursor}
+
+          (and (not (nil? m)) (not= m actual-m))
+          {:msg (str "sub-component m does not match for " expected-name)
+           :expected m :actual actual-m}
+
+          :else true
+          )
+         )
        )
-      )
-    )
+     )
   )

 (defn with-class [class-name]


implement apps api

implement apps api

--- src/clj/dokkaa_builder/route.clj
+++ src/clj/dokkaa_builder/route.clj
@@ -10,9 +10,13 @@
             [dokkaa-builder.oauth.github :as github]))

 (defn get-apps [req]
-  {:status 200
-   :body (j/encode {"apps1" {:id "123"}
-                    "apps2" {:id "234"}})})
+  (let [app-name (get-in req [:route-params :app])
+        token (get-in req [:params :token])
+        user  (auth/token->user token)]
+    (if user
+      {:status 200
+       :body (j/encode (apps/apps user))}
+      {:status 401, :body "token is invalid"})))

 (defn create-app [req]
   (let [app-name (get-in req [:route-params :app])
@@ -83,7 +87,7 @@
   (GET "/" req (index req))
   (GET "/_ping"  [] ping)
   (GET "/status" req (status-page req))
-  (context "/apps" req (friend/wrap-authorize apps-routes #{:user}))
+  (context "/apps" req apps-routes)
   (context "/user" req (friend/wrap-authorize users-routes))
   (resources "/")
   (friend/logout (ANY "/logout" request (ring.util.response/redirect "/")))