Making api tests works correctly

Making api tests works correctly

--- test/decimal/core_spec.cljs
+++ test/decimal/core_spec.cljs
@@ -47,9 +47,15 @@
   ["0", "-0", "-0.5", "-0.53", "-0.409325859"
    "0.1", "0.0799", "0.0769104749433424068"])

+(defn equal-or-both-NaN
+  [value1 value2]
+  (t/is (or
+    (and (dc/NaN? value1) (dc/NaN? value2))
+    (= value1 value2))))
+
 (t/deftest api-test
   (doseq [v +test-values+]
-    (t/is (= (dc/abs v) (.abs dc/+decimal+ v)))
+    (equal-or-both-NaN (dc/abs v) (.abs dc/+decimal+ v))
     (t/is (= (dc/finite? v) (.isFinite (dc/-decimal v))))
     (t/is (= (dc/integer? v) (.isInteger (dc/-decimal v))))
     (t/is (= (dc/NaN? v) (.isNaN (dc/-decimal v))))
@@ -60,31 +66,31 @@
     (t/is (= (dc/<= v 0) (.lte (dc/-decimal v) 0)))
     (t/is (= (dc/> v 0) (.gt (dc/-decimal v) 0)))
     (t/is (= (dc/>= v 0) (.gte (dc/-decimal v) 0)))
-    (t/is (= (dc/plus v 1) (.plus (dc/-decimal v) 1)))
-    (t/is (= (dc/minus v 1) (.minus (dc/-decimal v) 1)))
-    (t/is (= (dc/mul v 2) (.times (dc/-decimal v) 2)))
-    (t/is (= (dc/div v 2) (.div (dc/-decimal v) 2)))
-    (t/is (= (dc/floor v) (.floor (dc/-decimal v))))
-    (t/is (= (dc/round v) (.round (dc/-decimal v))))
-    (t/is (= (dc/ceil v) (.ceil (dc/-decimal v))))
-    (t/is (= (dc/sin v) (.sin (dc/-decimal v))))
-    (t/is (= (dc/cos v) (.cos (dc/-decimal v))))
-    (t/is (= (dc/tan v) (.tan (dc/-decimal v))))
-    (t/is (= (dc/asin v) (.asin (dc/-decimal v))))
-    (t/is (= (dc/acos v) (.acos (dc/-decimal v))))
-    (t/is (= (dc/atan v) (.atan (dc/-decimal v))))
-    (t/is (= (dc/sinh v) (.sinh (dc/-decimal v))))
-    (t/is (= (dc/cosh v) (.cosh (dc/-decimal v))))
-    (t/is (= (dc/tanh v) (.tanh (dc/-decimal v))))
-    ;; (t/is (= (dc/asinh v) (.asinh (dc/-decimal v))))
-    ;; (t/is (= (dc/acosh v) (.acosh (dc/-decimal v))))
-    ;; (t/is (= (dc/atanh v) (.atanh (dc/-decimal v))))
-    (t/is (= (dc/cbrt v) (.cubeRoot (dc/-decimal v))))
-    (t/is (= (dc/sqrt v) (.squareRoot (dc/-decimal v))))
-    ;; (t/is (= (dc/log v 2) (.log (dc/-decimal v) 2)))
-    ;; (t/is (= (dc/log2 v) (.log2 dc/+decimal+ v)))
-    ;; (t/is (= (dc/log10 v) (.log10 dc/+decimal+ v)))
-    (t/is (= (dc/mod v 2) (.mod (dc/-decimal v) 2)))
+    (equal-or-both-NaN (dc/plus v 1) (.plus (dc/-decimal v) 1))
+    (equal-or-both-NaN (dc/minus v 1) (.minus (dc/-decimal v) 1))
+    (equal-or-both-NaN (dc/mul v 2) (.times (dc/-decimal v) 2))
+    (equal-or-both-NaN (dc/div v 2) (.div (dc/-decimal v) 2))
+    (equal-or-both-NaN (dc/floor v) (.floor (dc/-decimal v)))
+    (equal-or-both-NaN (dc/round v) (.round (dc/-decimal v)))
+    (equal-or-both-NaN (dc/ceil v) (.ceil (dc/-decimal v)))
+    (equal-or-both-NaN (dc/sin v) (.sin (dc/-decimal v)))
+    (equal-or-both-NaN (dc/cos v) (.cos (dc/-decimal v)))
+    (equal-or-both-NaN (dc/tan v) (.tan (dc/-decimal v)))
+    (equal-or-both-NaN (dc/asin v) (.asin (dc/-decimal v)))
+    (equal-or-both-NaN (dc/acos v) (.acos (dc/-decimal v)))
+    (equal-or-both-NaN (dc/atan v) (.atan (dc/-decimal v)))
+    (equal-or-both-NaN (dc/sinh v) (.sinh (dc/-decimal v)))
+    (equal-or-both-NaN (dc/cosh v) (.cosh (dc/-decimal v)))
+    (equal-or-both-NaN (dc/tanh v) (.tanh (dc/-decimal v)))
+    (equal-or-both-NaN (dc/asinh v) (.asinh (dc/-decimal v)))
+    (equal-or-both-NaN (dc/acosh v) (.acosh (dc/-decimal v)))
+    (equal-or-both-NaN (dc/atanh v) (.atanh (dc/-decimal v)))
+    (equal-or-both-NaN (dc/cbrt v) (.cubeRoot (dc/-decimal v)))
+    (equal-or-both-NaN (dc/sqrt v) (.squareRoot (dc/-decimal v)))
+    (equal-or-both-NaN (dc/log v 2) (.log (dc/-decimal v) 2))
+    (equal-or-both-NaN (dc/log2 v) (.log2 dc/+decimal+ v))
+    (equal-or-both-NaN (dc/log10 v) (.log10 dc/+decimal+ v))
+    (equal-or-both-NaN (dc/mod v 2) (.mod (dc/-decimal v) 2))
     ))

 ;; (t/deftest operations-test


Don't display rows with no data.

Don't display rows with no data.

--- src-cljs/kixi/hecuba/tabs/hierarchy/profiles.cljs
+++ src-cljs/kixi/hecuba/tabs/hierarchy/profiles.cljs
@@ -86,6 +86,12 @@
                              (om/set-state! owner :editing false)
                              (om/set-state! owner :adding false)))} "Save"]]))

+(defn should-show? [owner profiles keys]
+  (or
+   (om/get-state owner :editing)
+   (om/get-state owner :adding)
+   (some (fn [profile] (some #(seq (str (val %))) (select-keys profile keys))) profiles)))
+
 (defn description-row [property_details]
   (fn [profiles owner]
     (reify
@@ -93,12 +99,17 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            [:div {:class (profile-column-width)}
-             (let [keys [:profile_data]]
-               (bs/panel
-                (panel-heading property_details owner profile "Description" {:add-btn false :edit-btn true} keys)
-                (pf/description owner profile keys)))])])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:intervention_start_date
+                                        :intervention_completion_date
+                                        :intervention_description])]
+            (for [profile profiles]
+              [:div {:class (profile-column-width)}
+               (let [keys [:profile_data]]
+                 (bs/panel
+                  (panel-heading property_details owner profile "Description" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                      (pf/description owner profile keys))))]))])))))

 (defn occupancy-row [property_details]
   (fn [profiles owner]
@@ -107,12 +118,19 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Occupancy" {:add-btn false :edit-btn true} keys)
-                (pf/occupancy owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:occupancy_total
+                                        :occupancy_under_18
+                                        :occupancy_18_to_60
+                                        :occupancy_over_60
+                                        :occupant_change])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Occupancy" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                      (pf/occupancy owner profile keys)))])))])))))

 (defn measurements-row [property_details]
   (fn [profiles owner]
@@ -121,12 +139,19 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Measurements" {:add-btn false :edit-btn true} keys)
-                (pf/measurements owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:footprint :external_perimeter
+                                        :gross_internal_area :number_of_storeys
+                                        :total_volume :total_rooms
+                                        :bedroom_count :habitable_rooms
+                                        :inadequate_heating :heated_habitable_rooms])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Measurements" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/measurements owner profile keys)))])))])))))

 (defn energy-row [property_details]
   (fn [profiles owner]
@@ -135,12 +160,22 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Energy" {:add-btn false :edit-btn true} keys)
-                (pf/energy owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:ber :ter :primary_energy_requirement
+                                        :space_heating_requirement
+                                        :annual_space_heating_requirement
+                                        :renewable_contribution_heat
+                                        :renewable_contribution_elec
+                                        :electricity_meter_type :mains_gas
+                                        :electricity_storage_present
+                                        :heat_storage_present])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Energy" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/energy owner profile keys)))])))])))))

 (defn passivhaus-row [property_details]
   (fn [profiles owner]
@@ -149,12 +184,16 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "PassivHaus" {:add-btn false :edit-btn true} keys)
-               (pf/passivhaus owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:passive_solar_strategy
+                                        :used_passivehaus_principles])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "PassivHaus" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/passivhaus owner profile keys)))])))])))))

 (defn efficiency-row [property_details]
   (fn [profiles owner]
@@ -163,12 +202,16 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Efficiency" {:add-btn false :edit-btn true} keys)
-                (pf/efficiency owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:pipe_lagging :draught_proofing
+                                        :draught_proofing_location])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Efficiency" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/efficiency owner profile keys)))])))])))))

 (defn flats-row [property_details]
   (fn [profiles owner]
@@ -177,12 +220,19 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Flats" {:add-btn false :edit-btn true} keys)
-                (pf/flats owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:flat_floors_in_block
+                                        :flat_floor_position :flat_heat_loss_corridor
+                                        :flat_heat_loss_corridor_other
+                                        :flat_length_sheltered_wall
+                                        :flat_floor_heat_loss_type])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Flats" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/flats owner profile keys)))])))])))))

 (defn fireplaces-row [property_details]
   (fn [profiles owner]
@@ -191,12 +241,15 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Fireplaces" {:add-btn false :edit-btn true} keys)
-               (pf/fireplaces owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:open_fireplaces :sealed_fireplaces])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Fireplaces" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/fireplaces owner profile keys)))])))])))))

 (defn glazing-row [property_details]
   (fn [profiles owner]
@@ -205,12 +258,21 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Glazing" {:add-btn false :edit-btn true} keys)
-                (pf/glazing owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:glazing_area_glass_only
+                                        :glazing_area_percentage
+                                        :multiple_glazing_type
+                                        :multiple_glazing_area_percentage
+                                        :multiple_glazing_u_value
+                                        :multiple_glazing_type_other
+                                        :frame_type :frame_type_other])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Glazing" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/glazing owner profile keys)))])))])))))

 (defn issues-row [property_details]
   (fn [profiles owner]
@@ -219,12 +281,17 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Issues" {:add-btn false :edit-btn true} keys)
-                (pf/issues owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:moisture_condensation_mould_strategy
+                                        :appliances_strategy
+                                        :cellar_basement_issues])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Issues" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/issues owner profile keys)))])))])))))

 (defn lessons-learnt-row [property_details]
   (fn [profiles owner]
@@ -233,12 +300,21 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Lesson Learnt" {:add-btn false :edit-btn true} keys)
-                (pf/lessons-learnt owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:thermal_bridging_strategy
+                                        :airtightness_and_ventilation_strategy
+                                        :overheating_cooling_strategy
+                                        :controls_strategy
+                                        :lighting_strategy
+                                        :water_saving_strategy
+                                        :innovation_approaches])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Lesson Learnt" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/lessons-learnt owner profile keys)))])))])))))

 (defn project-details-row [property_details]
   (fn [profiles owner]
@@ -247,12 +323,21 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Project Details" {:add-btn false :edit-btn true} keys)
-                (pf/project-details owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:total_budget_new_build
+                                        :estimated_cost_new_build
+                                        :final_cost_new_build
+                                        :construction_time_new_build
+                                        :design_guidance
+                                        :planning_considerations
+                                        :total_budget])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Project Details" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/project-details owner profile keys)))])))])))))

 (defn coheating-test-row [property_details]
   (fn [profiles owner]
@@ -261,12 +346,18 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Coheating Test" {:add-btn false :edit-btn true} keys)
-                (pf/coheating-test owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:co_heating_loss
+                                        :co_heating_performed_on
+                                        :co_heating_assessor
+                                        :co_heating_equipment])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Coheating Test" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/coheating-test owner profile keys)))])))])))))

 (defn dwelling-u-values-summary-row [property_details]
   (fn [profiles owner]
@@ -275,12 +366,22 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Dwelling U-values Summary" {:add-btn false :edit-btn true} keys)
-                (pf/dwelling-u-values-summary owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:best_u_value_for_doors
+                                        :best_u_value_for_floors
+                                        :best_u_value_for_other
+                                        :best_u_value_for_roof
+                                        :best_u_value_for_walls
+                                        :best_u_value_for_windows
+                                        :best_u_value_party_walls
+                                        :dwelling_u_value_other])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Dwelling U-values Summary" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/dwelling-u-values-summary owner profile keys)))])))])))))

 (defn air-tightness-test-row [property_details]
   (fn [profiles owner]
@@ -289,12 +390,18 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "Air Tightness Test" {:add-btn false :edit-btn true} keys)
-                (pf/air-tightness-test owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:air_tightness_assessor
+                                        :air_tightness_equipment
+                                        :air_tightness_performed_on
+                                        :air_tightness_rate])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "Air Tightness Test" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/air-tightness-test owner profile keys)))])))])))))

 (defn bus-survey-information-row [property_details]
   (fn [profiles owner]
@@ -303,12 +410,28 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "BUS Survey Information" {:add-btn false :edit-btn true} keys)
-                (pf/bus-survey-information owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:profile_temperature_in_summer
+                                        :profile_temperature_in_winter
+                                        :profile_air_in_summer
+                                        :profile_air_in_winter
+                                        :profile_lightning
+                                        :profile_noise
+                                        :profile_comfort
+                                        :profile_design
+                                        :profile_needs
+                                        :profile_health
+                                        :profile_image_to_visitors
+                                        :profile_productivity
+                                        :profile_bus_summary_index
+                                        :profile_bus_report_url])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "BUS Survey Information" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/bus-survey-information owner profile keys)))])))])))))

 (defn sap-results-row [property_details]
   (fn [profiles owner]
@@ -317,12 +440,21 @@
       (render-state [_ state]
         (html
          [:div.col-md-12
-          (for [profile profiles]
-            (let [keys [:profile_data]]
-              [:div {:class (profile-column-width)}
-               (bs/panel
-                (panel-heading property_details owner profile "SAP Results" {:add-btn false :edit-btn true} keys)
-                (pf/sap-results owner profile keys))]))])))))
+          (let [display? (should-show? owner (mapv #(get % :profile_data) profiles)
+                                       [:sap_rating
+                                        :sap_performed_on
+                                        :sap_assessor
+                                        :sap_version_issue
+                                        :sap_version_year
+                                        :sap_regulations_date
+                                        :sap_software])]
+            (for [profile profiles]
+              (let [keys [:profile_data]]
+                [:div {:class (profile-column-width)}
+                 (bs/panel
+                  (panel-heading property_details owner profile "SAP Results" {:add-btn false :edit-btn true} keys)
+                  (when display?
+                    (pf/sap-results owner profile keys)))])))])))))

 ;; Fields containing lists

@@ -346,10 +478,11 @@
                     (let [profile (assoc profile :conservatories (vec conservatories))]
                       :div
                       (for [c conservatories]
-                        (let [keys [:conservatories (.indexOf (to-array conservatories) c)]]
-                          (bs/panel
-                           (panel-heading property_details owner profile "Conservatory" {:add-btn false :edit-btn true} keys)
-                           (pf/conservatory owner profile keys)))))
+                        (when (seq c)
+                          (let [keys [:conservatories (.indexOf (to-array conservatories) c)]]
+                            (bs/panel
+                             (panel-heading property_details owner profile "Conservatory" {:add-btn false :edit-btn true} keys)
+                             (pf/conservatory owner profile keys))))))
                     [:p "No conservatories."]))))])])))))

 (defn extensions-row [property_details]
@@ -372,10 +505,11 @@
                     (let [profile (assoc profile :extensions (vec extensions))]
                       [:div
                        (for [item extensions]
-                         (let [keys [:extensions (.indexOf (to-array extensions) item)]]
-                           (bs/panel
-                            (panel-heading property_details owner profile "Extension" {:add-btn false :edit-btn true} keys)
-                            (pf/extension owner profile keys))))])
+                         (when (seq item)
+                           (let [keys [:extensions (.indexOf (to-array extensions) item)]]
+                             (bs/panel
+                              (panel-heading property_details owner profile "Extension" {:add-btn false :edit-btn true} keys)
+                              (pf/extension owner profile keys)))))])
                     [:p "No extensions."]))))])])))))

 (defn heating-systems-row [property_details]


Fix temp numbering in canon test

Fix temp numbering in canon test

--- test/minijava/test_canon.clj
+++ test/minijava/test_canon.clj
@@ -225,9 +225,9 @@
 				n (tm/label)
 				prog(Call p [(Call c [(Call n ['Fac]) (Const 10)])])			]
    (is (= (canon prog)
-         [(Move (Call n ['Fac]) (tm/temp 7))
-					(Move (Call c [(Temp (tm/temp 7)) (Const 10)]) (tm/temp 6))
-					(Call p [(Temp (tm/temp 6))])
+         [(Move (Call n ['Fac]) (tm/temp 5))
+					(Move (Call c [(Temp (tm/temp 5)) (Const 10)]) (tm/temp 4))
+					(Call p [(Temp (tm/temp 4))])
           ]  ))))


Fix typos in test docstrings

Fix typos in test docstrings

--- test/re_frame/subs_test.cljs
+++ test/re_frame/subs_test.cljs
@@ -220,7 +220,7 @@
     (is (= {:a [1 :c] :b [2 :c]} @test-sub))))

 (deftest test-sub-macros-<-
-  "test the syntactial sugar"
+  "test the syntactical sugar"
   (subs/reg-sub
     :a-sub
     (fn [db [_]] (:a db)))
@@ -235,7 +235,7 @@
     (is (= {:a 1} @test-sub))))

 (deftest test-sub-macros-chained-parameters-<-
-  "test the syntactial sugar"
+  "test the syntactical sugar"
   (subs/reg-sub
     :a-sub
     (fn [db [_]] (:a db)))
@@ -252,7 +252,7 @@

   (let [test-sub (subs/subscribe [:a-b-sub :c])]
     (reset! db/app-db {:a 1 :b 2})
-    (is (= {:a 1 :b 2} @test-sub) )))
+    (is (= {:a 1 :b 2} @test-sub))))

 (deftest test-registering-subs-doesnt-create-subscription
   (let [sub-called? (atom false)]


Add ability to set persistence options

Add ability to set persistence options

--- elephantdb-cascalog/src/clj/elephantdb/cascalog/conf.clj
+++ elephantdb-cascalog/src/clj/elephantdb/cascalog/conf.clj
@@ -1,18 +1,22 @@
 (ns elephantdb.cascalog.conf
   (:require [cascalog.workflow :as w])
-  (:import [elephantdb DomainSpec]
+  (:import [elephantdb DomainSpec DomainSpec$Args]
            [elephantdb.cascading ElephantDBTap$Args]
            [java.util ArrayList]))

 (defn convert-java-domain-spec [^DomainSpec spec]
   {:coordinator  (.getCoordinator spec)
    :shard-scheme (.getShardScheme spec)
-   :num-shards   (.getNumShards spec)})
+   :num-shards   (.getNumShards spec)
+   :persistence-options (.getPersistenceOptions spec)})

 (defn convert-clj-domain-spec
-  [{:keys [coordinator shard-scheme num-shards]}]
+  [{:keys [coordinator shard-scheme num-shards persistence-options]}]
   {:pre [(and coordinator shard-scheme num-shards)]}
-  (DomainSpec. coordinator shard-scheme num-shards))
+  (when persistence-options
+    (let [args (DomainSpec$Args.)]
+      (set! (.persistenceOptions args) persistence-options)
+      (DomainSpec. coordinator shard-scheme num-shards args))))

 (defn read-domain-spec
   "A domain spec is stored with shards in the VersionedStore. Look to


Updates for Jan 2020 and simplified logic

- Removed processing of "renew until further notice" column
- Abstracted "first-name" logic, now also used in "Dear <person>"

--- scrape-n-mail/src/scrape_n_mail/core.cljs
+++ scrape-n-mail/src/scrape_n_mail/core.cljs
@@ -52,6 +52,10 @@
                  ::submitter-email ::submitter-name
                  ::renew-indefinitely]
            :opt [::procunciation-hints]))
+
+(defn first-name [full-name]
+  ; We likely need a dictionary for stop-words like "Ms."
+  (first (split full-name #"\s+")) )

 ; this is a bit brittle - based on the structure of the form at some point in time
 (defn row-to-held-person [[timestamp name-for-altar _ pronunciation your-name
@@ -68,16 +72,14 @@
        ; The logic is a little complex
        ; If we lack a public name, we propose one - if it's a group, we just
        ; use the full text, otherwise we use the first word of the altar name.
-       ; We likely need a dictionary for stop-words like "Ms."
-       ::held-name-public (if (empty? name-public)
+       ::held-name-public (if (empty? name-public)
                             (if processed-group
                               name-for-altar
-                              (first (split name-for-altar #"\s+")) )
+                              (first-name name-for-altar))
                             name-public)
        ; ::is-group-or-class is-group?
        ::submitter-email (trim (lower-case (str your-email)))
-       ::submitter-name (trim (str your-name))
-       ::renew-indefinitely (not (= "" (str renew-indefinitely)))} )
+       ::submitter-name (trim (str your-name)) })
       ; And the optional field
       (when-not (empty? pronunciation) {::procunciation-hints pronunciation}) ))

@@ -100,7 +102,7 @@
 (defn update-after-auth [is-signed-in]
   (swap! app-data assoc :signed-in? is-signed-in)
   (if is-signed-in
-    (get-wellbeing-data)
+    (get-wellbeing-data)
     (swap! app-data assoc :sheet-data nil) ))

@@ -122,7 +124,7 @@
              )))

 ; In retrospect, this was not really useful (these keys aren't secret).
-; We're also hurting performance a little, but it's not relevant to our
+; We're also hurting performance a little, but it's not relevant to our
 ; use-case so I'm leaving it alone.
 (go (let [keys-resp (<! (http/get "keys.json"))]
       ; (println keys-resp)
@@ -167,7 +169,7 @@
                   (if group "entry.628312063=YES,+this+is+a+group")
                   (str "entry.552838120=" submitter-name)
                   (str "entry.681476151=" submitter-email)
-                  (if renew-indefinitely "entry.1548017252=Yes,+please")])]
+                  ])]

     [:a {:href custom-url} name-altar]
   ))
@@ -189,9 +191,9 @@
       [:hr]
       [:p submitter-email]
       [:br]
-      [:p "Dear " (::submitter-name (first name-records)) ","]
-
-      [:p "Our general call for names for Wellbeing for December 2019 has gone out to the newDharma mailing list."]
+      [:p "Dear " (first-name (::submitter-name (first name-records))) ","]
+
+      [:p "Our general call for names for Wellbeing for January 2020 has gone out to the newDharma mailing list."]

       [:p "Currently, the community is holding the following names on the altar "
           "in support of their wellbeing at your request. Click "
@@ -214,9 +216,7 @@
                "along with the submission of names. Here's "
                [:a {:href payment-link} "the link."]]]

-      [:p "If we do not hear from you, we will remove the above names from the altar "
-          "unless you had checked the \"Renew until further notice?\" box on the form. "
-          "But please renew them if you can so that we can transition away from this \"indefinite\" approach. "
+      [:p "If we do not hear from you, we will remove the above names from the altar. "
           "J'ai mitra!"]

       ; Note that the \ is an escape character!
@@ -227,13 +227,13 @@
   (let [curr-data (rum/react app-data)]
     [:div
       [:h2 "Wellness Scraper"]
-      [:p "First, we authenticate you to Google, then get some data from "
+      [:p "First, we authenticate you to Google, then get some data from "
        [:a {:href "https://docs.google.com/spreadsheets/d/1bv6vgW-HMTz0uhKDkrJoTg387b-WK6IFkFd9y6N96hA/edit#gid=0"}
         "the Wellenss spreadsheet"]]
         (if (:initialized curr-data)
           (if-not (:signed-in? curr-data)
             [:button {:id "authorize-button" :on-click #(.. js/gapi.auth2 getAuthInstance signIn)} "Authorize"]
-            [:button {:id "sign-out-button" :on-click #(.. js/gapi.auth2 getAuthInstance signOut)} "Sign Out"])
+            [:button {:id "sign-out-button" :on-click #(.. js/gapi.auth2 getAuthInstance signOut)} "Sign Out"])
           [:p "Initializing Google API"])

         (when-let [records (:sheet-data curr-data)]


improved validation

improved validation

--- src/cljs/org/broadinstitute/firecloud_ui/page/methods_configs_acl.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/methods_configs_acl.cljs
@@ -29,10 +29,12 @@
   (nth access-levels idx))

 (defn- access-level-to-index [access-level]
-  (case access-level
-    reader-level 0
-    owner-level 1
-    no-access-level 2))
+  (cond
+    (= "READER" access-level) 0
+    (= "OWNER" access-level) 1
+    (= "NO ACCESS" access-level) 2
+    :else (do  (utils/rlog (str "Unknown access-level :'" access-level "'"))  reader-level)))
+

 (def ^:private column-width "calc(50% - 4px)")

@@ -73,6 +75,11 @@
         ;if public is in the acl return the value of the last one
         lastPublicAccessLevel))))

+
+
+(defn- validate-user [acl-map]
+  (let [user (acl-map :user)]
+    (not (= "public" user))))

 (react/defc AgoraPermsEditor
@@ -112,14 +119,7 @@
                                                          (:background-gray style/colors))}
                               :disabled (< i (:count-orig @state))
                               :spellCheck false
-                              :defaultValue (:user acl-entry)
-                              :onChange (fn [e]
-                                          (let [new-val (-> e .-target .-value)
-                                                new-val-is-public (= "public" new-val)]
-                                            (when new-val-is-public
-                                              (do
-                                                (js/alert "Cannot set value to 'public'!  Use the check-box instead.")
-                                                (set! (-> e .-target .-value) "")))))})
+                              :defaultValue (:user acl-entry)})
                            (style/create-select
                              {:ref (str "acl-value" i)
                               :style {:float "right" :width column-width :height 33}
@@ -177,20 +177,27 @@
                      (swap! state assoc :error status-text)))}))
    :persist-acl
    (fn [{:keys [props state this]}]
-     (swap! state assoc :saving? true)
-     (swap! state assoc :acl-vec
-       (flatten [{:user "public" :role
-                 (if (:public-status @state) reader-level no-access-level)}
-       (react/call :capture-ui-state this)]))
-     (endpoints/call-ajax-orch
-       {:endpoint (endpoints/persist-agora-method-acl (:selected-entity props))
-        :headers {"Content-Type" "application/json"}
-        :payload (filterv #(not (empty? (:user %))) (:acl-vec @state))
-        :on-done (fn [{:keys [success? status-text]}]
-                   (swap! state dissoc :saving?)
-                   (if success?
-                     ((:dismiss-self props))
-                     (js/alert "Error saving permissions: " status-text)))}))
+     (swap! state assoc :acl-vec (react/call :capture-ui-state this))
+     (let [validity-flags (map validate-user (:acl-vec @state))
+           all-valid (every? true? validity-flags)]
+       (if all-valid
+         (let
+           [non-empty-acls (filterv #(not (empty? (:user %))) (:acl-vec @state))
+            non-empty-acls-w-public (flatten [non-empty-acls
+                                              {:user "public" :role
+                                               (if (:public-status @state)
+                                                 reader-level no-access-level)}])]
+           (swap! state assoc :saving? true)
+           (endpoints/call-ajax-orch
+             {:endpoint (endpoints/persist-agora-method-acl (:selected-entity props))
+              :headers {"Content-Type" "application/json"}
+              :payload non-empty-acls-w-public
+              :on-done (fn [{:keys [success? status-text]}]
+                         (swap! state dissoc :saving?)
+                         (if success?
+                           ((:dismiss-self props))
+                           (js/alert "Error saving permissions: " status-text)))}))
+         (js/alert "Cannot set value to 'public'!  Use the check-box instead."))))
    :capture-ui-state
    (fn [{:keys [state refs]}]
      (mapv


template for customer quotes

template for customer quotes

--- src-cljs/frontend/components/landing.cljs
+++ src-cljs/frontend/components/landing.cljs
@@ -28,6 +28,31 @@
   (:require-macros [sablono.core :refer (html)]
                    [cljs.core.async.macros :as am :refer [go go-loop alt!]])
   (:import [goog.ui IdGenerator]))
+
+(def customers
+  {:cognician {:name "Cognician"
+               :logo ""
+               :quote "You've breathed life into collaboration by making it effortless."
+               :cite "Robert Stuttaford"
+               :role "CTO"
+               :avatar (utils/gravatar-url "robert@cognician.com")}})
+
+(defn customer-quote [customer]
+  (html
+   [:div.trusted
+    [:div.trusted-logo.trusted-item
+     (common/icon customer)]
+    [:div.trusted-quote.trusted-item.content
+     [:p
+      [:span (get-in customers [customer :quote])]]]
+    [:div.trusted-cite.trusted-item
+     [:div.trusted-avatar
+      [:img {:src (get-in customers [customer :avatar])}]]
+     [:div.trusted-info
+      [:div.trusted-name
+       [:span (get-in customers [customer :cite])]]
+      [:div.trusted-title
+       [:span (str (get-in customers [customer :role]) " at " (get-in customers [customer :name]))]]]]]))

 (def artwork-mobile
   (html
@@ -360,5 +385,6 @@
           (om/build drawing/landing-background {:subscribers (get-in app [:subscribers :info])}
                     {:react-key "landing-background"})
           (om/build the-why app)
+          (customer-quote :cognician)
           (om/build the-how app)
           (om/build the-what app)])))))


flip order of mouse shortcuts

flip order of mouse shortcuts

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -313,32 +313,32 @@
                [:td
                 [:div.shortcuts-keys
                  [:div.shortcuts-key  {:title "Option Key"} (common/icon :option)]
+                 [:div.shortcuts-misc {:title "Left Click"} (common/icon :mouse)]]]
+               [:td [:div.shortcuts-result {:title "Hold option, drag shape(s)."} "Duplicate"]]]
+              [:tr
+               [:td
+                [:div.shortcuts-keys
+                 [:div.shortcuts-key  {:title "Option Key"} (common/icon :option)]
                  [:div.shortcuts-misc {:title "Scroll Wheel"} (common/icon :scroll)]]]
                [:td [:div.shortcuts-result {:title "Hold option, scroll."} "Zoom"]]]
-              [:tr
-               [:td
-                [:div.shortcuts-keys
-                 [:div.shortcuts-key  {:title "Option Key"} (common/icon :option)]
+              ;;
+              ;; keystrokes beginning with "shift"
+              ;;
+              [:tr
+               [:td {:col-span "2"}]]
+              [:tr
+               [:td
+                [:div.shortcuts-keys
+                 [:div.shortcuts-key  {:title "Shift Key"} (common/icon :shift)]
                  [:div.shortcuts-misc {:title "Left Click"} (common/icon :mouse)]]]
-               [:td [:div.shortcuts-result {:title "Hold option, drag shape(s)."} "Duplicate"]]]
-              ;;
-              ;; keystrokes beginning with "shift"
-              ;;
-              [:tr
-               [:td {:col-span "2"}]]
+               [:td [:div.shortcuts-result {:title "Hold shift, click multiple shapes."} "Stack"]]]
               [:tr
                [:td
                 [:div.shortcuts-keys
                  [:div.shortcuts-key  {:title "Shift Key"} (common/icon :shift)]
                  [:div.shortcuts-misc {:title "Scroll Wheel"} (common/icon :scroll)]]]
                [:td [:div.shortcuts-result {:title "Hold shift, scroll."} "Pan"]]]
-              [:tr
-               [:td
-                [:div.shortcuts-keys
-                 [:div.shortcuts-key  {:title "Shift Key"} (common/icon :shift)]
-                 [:div.shortcuts-misc {:title "Left Click"} (common/icon :mouse)]]]
-               [:td [:div.shortcuts-result {:title "Hold shift, click multiple shapes."} "Stack"]]]]]
-            ]]])))))
+              ]]]]])))))

 (defn username [app owner]
   (reify


Better projects feedback.

Better projects feedback.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -147,6 +147,19 @@
 (defn title-for-sensor [{:keys [selected]}]
   (let [[type _] (str/split selected #"-")]
     type))
+
+(defn error-row [data]
+  [:div.row
+   [:div.col-md-12.text-center
+    [:p.lead {:style {:padding-top 30}}
+     "There has been an error. Please contact " [:a {:href "mailto:support@mastodonc.com"} "support@mastodonc.com"]]
+    [:p "Error Code: " (:error-status data) " Message: " (:error-text data)]]])
+
+(defn no-data-row [data]
+  [:div.row [:div.col-md-12.text-center [:p.lead {:style {:padding-top 30}} "No data available for this selection."]]])
+
+(defn fetching-row [data]
+  [:div.row [:div.col-md-12.text-center [:p.lead {:style {:padding-top 30}} "Fetching properties for selected project." ]]])

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; programmes
@@ -217,31 +230,48 @@
   [project]
   (assoc project :slug (:name project)))

+(defmulti projects-table-html (fn [projects owner] (:fetching projects)))
+(defmethod projects-table-html :fetching [projects owner]
+  (fetching-row projects))
+
+(defmethod projects-table-html :no-data [projects owner]
+  (no-data-row projects))
+
+(defmethod projects-table-html :error [projects owner]
+  (error-row projects))
+
+(defmethod projects-table-html :has-data [projects owner]
+  (let [table-id   "projects-table"
+        history    (om/get-shared owner :history)]
+    [:div.row
+     [:div.col-md-12
+      [:table {:className "table table-hover"}
+       [:thead
+        [:tr [:th "Name"] [:th "Type"] [:th "Description"] [:th "Created At"] [:th "Organisation"] [:th "Project Code"]]]
+       [:tbody
+        (for [row (sort-by :id (:data projects))]
+          (let [{:keys [id name type-of description created-at organisation project-code]} row]
+            [:tr {:onClick (fn [_ _]
+                             (om/update! projects :selected id)
+                             (history/update-token-ids! history :projects id)
+                             (fixed-scroll-to-element "properties-div"))
+                  :className (if (= id (:selected projects)) "success")
+                  :id (str table-id "-selected")}
+             [:td name]
+             [:td type-of]
+             [:td description]
+             [:td created-at]
+             [:td organisation]
+             [:td project-code]]))]]]]))
+
+(defmethod projects-table-html :default [projects owner]
+  [:div.row [:div.col-md-12]])
+
 (defn projects-table [projects owner]
   (reify
     om/IRender
     (render [_]
-      (let [table-id   "projects-table"
-            history    (om/get-shared owner :history)]
-        (html
-         [:table {:className "table table-hover"}
-          [:thead
-           [:tr [:th "Name"] [:th "Type"] [:th "Description"] [:th "Created At"] [:th "Organisation"] [:th "Project Code"]]]
-          [:tbody
-           (for [row (sort-by :id (:data projects))]
-             (let [{:keys [id name type-of description created-at organisation project-code]} row]
-               [:tr {:onClick (fn [_ _]
-                                (om/update! projects :selected id)
-                                (history/update-token-ids! history :projects id)
-                                (fixed-scroll-to-element "properties-div"))
-                     :className (if (= id (:selected projects)) "success")
-                     :id (str table-id "-selected")}
-                [:td name]
-                [:td type-of]
-                [:td description]
-                [:td created-at]
-                [:td organisation]
-                [:td project-code]]))]])))))
+      (html (projects-table-html projects owner)))))

 (defn projects-div [data owner]
   (reify
@@ -257,15 +287,21 @@

         ;; get the data if we have a new id
         (if (and new-programme-id
-                   (not (= (:programme-id projects) new-programme-id)))
-          (GET (str "/4/programmes/" new-programme-id "/projects/")
-               {:handler  (fn [x]
-                            (println "Fetching projects for programme: " new-programme-id)
-                            (om/update! projects :data (mapv slugify-project x))
-                            (om/update! projects :selected nil))
-                ;; TODO: Add Error Handler
-                :headers {"Accept" "application/edn"}
-                :response-format :text}))
+                 (not (= (:programme-id projects) new-programme-id)))
+          (do
+            (om/update! projects :fetching :fetching)
+            (GET (str "/4/programmes/" new-programme-id "/projects/")
+                 {:handler  (fn [x]
+                              (println "Fetching projects for programme: " new-programme-id)
+                              (om/update! projects :data (mapv slugify-project x))
+                              (om/update! projects :fetching (if (empty? x) :no-data :has-data))
+                              (om/update! projects :selected nil))
+                  :error-handler (fn [{:keys [status status-text]}]
+                                   (om/update! projects :fetching :error)
+                                   (om/update! projects :error-status status)
+                                   (om/update! projects :error-text status-text))
+                  :headers {"Accept" "application/edn"}
+                  :response-format :text})))

         ;; update our current id with the new one
         (om/update! projects :programme-id new-programme-id)
@@ -297,17 +333,13 @@

 (defmulti properties-table-html (fn [properties owner] (:fetching properties)))
 (defmethod properties-table-html :fetching [properties owner]
-  [:div.row [:div.col-md-12.text-center [:p.lead {:style {:padding-top 30}} "Fetching properties for selected project." ]]])
+  (fetching-row properties))

 (defmethod properties-table-html :no-data [properties owner]
-  [:div.row [:div.col-md-12.text-center [:p.lead {:style {:padding-top 30}} "No data available for this selection."]]])
+  (no-data-row properties))

 (defmethod properties-table-html :error [properties owner]
-  [:div.row
-   [:div.col-md-12.text-center
-    [:p.lead {:style {:padding-top 30}}
-     "There has been an error. Please contact " [:a {:href "mailto:support@mastodonc.com"} "support@mastodonc.com"]]
-    [:p "Error Code: " (:error-status properties) " Message: " (:error-text properties)]]])
+  (error-row properties))

 (defmethod properties-table-html :has-data [properties owner]
   (let [table-id "properties-table"


Fix data

Fix data

--- src/clj_simple_chart/ncs/johan_highlight_data.clj
+++ src/clj_simple_chart/ncs/johan_highlight_data.clj
@@ -7,39 +7,22 @@
 ; pdo approved
 ; producing and shut-down
 (def reserve-type [:pdo-approved :decided-for-production :producing :shut-down])
-(def reserve-field-names (->> discovery/parsed
-                              (filter #(some #{(:status %)} reserve-type))
+
+(def reserves (->> discovery/parsed
+                   (filter #(some #{(:status %)} reserve-type))))
+
+(def reserve-field-names (->> reserves
                               (map :name)
                               (distinct)
                               (sort)
                               (vec)))

-(def top-11-players-names (conj (->> discovery/parsed
-                                     (filter #(some #{(:name %)} reserve-field-names))
+(def top-11-players-names (conj (->> reserves
                                      (sort-by :fldRecoverableLiquids)
                                      (take-last 10)
                                      (sort-by :year)
                                      (mapv :name))
                                 "JOHAN CASTBERG"))
-
-(def other-fields (->> discovery/parsed
-                       (remove #(some #{(:name %)} top-11-players-names))))
-
-(def top-fields (->> discovery/parsed
-                     (filter #(some #{(:name %)} top-11-players-names))))
-
-(defn remaining-at-time [flds year kind]
-  (let [original-recoverable (->> discovery/parsed
-                                  (filter #(some #{(:name %)} flds))
-                                  (filter #(>= year (:year %)))
-                                  (map (get {:liquids   :fldRecoverableLiquids
-                                             :gas       :fldRecoverableGas
-                                             :petroleum :fldRecoverableOE} kind))
-                                  (reduce + 0))
-        produced (production/cumulative-production (filter #(some #{%} production/field-names) flds)
-                                                   year
-                                                   kind)]
-    (- original-recoverable produced)))

 (test/is (= top-11-players-names
             ["EKOFISK"
@@ -53,3 +36,25 @@
              "HEIDRUN"
              "JOHAN SVERDRUP"
              "JOHAN CASTBERG"]))
+
+(def other-fields (->> reserves
+                       (remove #(some #{(:name %)} top-11-players-names))))
+
+(def other-field-names (mapv :name other-fields))
+
+(def top-fields (->> reserves
+                     (filter #(some #{(:name %)} top-11-players-names))))
+
+(defn remaining-at-time [flds year kind]
+  (let [original-recoverable (->> reserves
+                                  (filter #(some #{(:name %)} flds))
+                                  (filter #(>= year (:year %)))
+                                  (map (get {:liquids   :fldRecoverableLiquids
+                                             :gas       :fldRecoverableGas
+                                             :petroleum :fldRecoverableOE} kind))
+                                  (reduce + 0))
+        produced (production/cumulative-production (filter #(some #{%} production/field-names) flds)
+                                                   year
+                                                   kind)]
+    (- original-recoverable produced)))
+


Matching timing nav switch infrastructure

--- src/edu/berkeley/ai/scripts/timing_nav_switch.clj
+++ src/edu/berkeley/ai/scripts/timing_nav_switch.clj
@@ -91,6 +91,24 @@

+(def *nav*
+ (map #(strips/constant-predicate-simplify (apply nav-switch/make-nav-switch-strips-env %))
+      [[5 5 [[1 1]] [0 4] false [4 0]]
+       [20 20 [[3 7] [12 18] [16 2]] [19 0] true [0 19]]
+       [100 100 [[26 91] [50 24] [54 97] [2 35] [25 9] [34 53] [2 16] [49 47] [67 10] [23 82]] [99 0] true [0 99]]]))
+
+(def *nav-goals* [[4 0] [0 19] [0 99]])
+
+(defn test-icaps-nav [i & alt-args]
+  (let [e (nth *nav* i)
+	h (nav-switch/make-flat-nav-switch-heuristic (nth *nav-goals* i))]
+    (doseq [[alg node]
+	    [[textbook/a-star-graph-search (search/ss-node e h)]
+	     [algs/aha-star-search (apply alts/alt-node (strips-hierarchies/get-flat-strips-hierarchy e h) alt-args)]
+	     [algs/aha-star-search (apply alts/alt-node (hierarchies/get-hierarchy nav-switch/*nav-switch-flat-hierarchy*  e) alt-args)]
+	     [algs/aha-star-search (apply alts/alt-node (hierarchies/get-hierarchy nav-switch/*nav-switch-hierarchy* e) alt-args)]]]
+      (search/reset-ref-counter)
+      (println [(time (second (alg node))) (util/sref-get search/*ref-counter*)]))))


remove debug output

remove debug output

--- src/gorillalabs/tesla/component/authorization.clj
+++ src/gorillalabs/tesla/component/authorization.clj
@@ -57,8 +57,6 @@
 (defn- create-authorization []
   (let [config config/configuration
         state (get-state config)]
-    (println (str "config " config))
-    (println (str "state " state))
     (assoc state :backend (auth/jwe-backend state))))

 (defn- start []


remove nashorn deprecation warning flag

remove nashorn deprecation warning flag

it seems to prevent engine creation pre-jdk11

--- src/main/shadow/cljs/devtools/server/npm_deps.clj
+++ src/main/shadow/cljs/devtools/server/npm_deps.clj
@@ -9,7 +9,7 @@
   (:import (javax.script ScriptEngineManager ScriptEngine Invocable)))

 (defn make-engine []
-  (System/setProperty "nashorn.args" "--no-deprecation-warning")
+  ;; (System/setProperty "nashorn.args" "--no-deprecation-warning")
   (let [engine
         (-> (ScriptEngineManager.)
             (.getEngineByName "nashorn"))


Added an event notification channel

Added an event notification channel

--- src/om_semantic/dropdown.cljs
+++ src/om_semantic/dropdown.cljs
@@ -1,5 +1,6 @@
 (ns om-semantic.dropdown
-  (:require [om.core :as om :include-macros true]
+  (:require [cljs.core.async :as async :refer [put!]]
+            [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]))

 ;; Utilities - should be moved to separate file when more components are added
@@ -21,11 +22,15 @@
         cursor   (if (< 1 (count selected))
                    (get-in data (pop selected))
                    data)]
+    (when-let [ch (om/get-state owner :ch)]
+      (put! ch [:select value]))
     (om/update! cursor (last selected) value)))

 (defn dropdown-click
   "Dropdown is clicked"
   [owner]
+  (when-let [ch (om/get-state owner :ch)]
+    (put! ch [:click nil]))
   (om/update-state! owner :open not))

 (defn -itemdiv
@@ -55,7 +60,7 @@
    default-text: What shows if nothing is selected
    lkey: which key in the menu items that should be used as label (text)
    name: the name of the input field"
-  [data owner]
+  [data owner {:keys [ch]}]
   (reify
     om/IDisplayName
     (display-name [_]
@@ -66,7 +71,8 @@
        :name "dropdown"
        :tabidx 0
        :disabled false
-       :open false})
+       :open false
+       :ch ch})
     om/IRenderState
     (render-state [_ {:keys [name lkey idkey open disabled
                              tabidx default-text class] :as state}]


Improve physics docstrings

Improve physics docstrings

--- src/play_clj/core_physics.clj
+++ src/play_clj/core_physics.clj
@@ -6,11 +6,14 @@
   (fn [screen & [entities]] (-> screen (u/get-obj :world) class)))

 (defmulti add-body!
-  "Adds the `body` to the `screen` for physics simulations and returns it."
+  "Adds the `body` to the `screen` for physics simulations and returns it. For
+2D physics, `body` should be a `body-def`, whereas for 3D physics it should be a
+`basic-body` or a `rigid-body`."
   (fn [screen body] (-> screen (u/get-obj :world) class)))

 (defmulti body-position!
-  "Changes the position of the body in `entity`."
+  "Changes the position of the body in `entity`. For 2D physics, the arguments
+should be x, y, and angle, whereas for 3D physics they should be x, y, and z."
   (fn [entity a1 a2 a3] (-> entity (u/get-obj :body) class)))

 (defmulti body-x!
@@ -22,9 +25,9 @@
   (fn [entity y] (-> entity (u/get-obj :body) class)))

 (defmulti body-z!
-  "Changes the `z` of the body in `entity`."
+  "Changes the `z` of the body in `entity`. Only works with 3D physics."
   (fn [entity z] (-> entity (u/get-obj :body) class)))

 (defmulti body-angle!
-  "Changes the `angle` of the body in `entity`."
+  "Changes the `angle` of the body in `entity`. Only works with 2D physics."
   (fn [entity angle] (-> entity (u/get-obj :body) class)))


Always build search the same way

Always build search the same way

--- src-cljs/frontend/components/documentation.cljs
+++ src-cljs/frontend/components/documentation.cljs
@@ -80,7 +80,6 @@
         docs (get-in app state/docs-data-path)]
     (html
      [:div
-      (om/build docs-search app)
       (when query-results
         [:div.article_list
          (if (empty? query-results)
@@ -160,8 +159,7 @@
        [:aside
         (om/build docs-categories categories)]
        [:article
-        (when subpage
-          (om/build docs-search app))
+        (om/build docs-search app)
         (if-not subpage
           (om/build front-page app)
           (om/build docs-subpage doc {:opts {:_fragment fragment}}))]]])))


Bring index tests back

Bring index tests back

--- test/clojure/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojure/clojurewerkz/cassaforte/cql_test.clj
@@ -122,9 +122,9 @@

   (deftest test-counter
     (testing "Increment by"
-        (update s :user_counters
-                {:user_count (new-query-api/increment-by 5)}
-                (where {:name "user1"}))
+      (update s :user_counters
+              {:user_count (new-query-api/increment-by 5)}
+              (where {:name "user1"}))

       (is (= 5 (-> (select s :user_counters)
                    first
@@ -176,8 +176,28 @@
   (deftest test-index-filtering-range
     (create-index s :city
                   (new-query-api/on-table :users)
-                  (new-query-api/and-column :city)
-                  )
+                  (new-query-api/and-column :city))
+    (create-index s :age
+                  (new-query-api/on-table :users)
+                  (new-query-api/and-column :age))
+
+    (dotimes [i 10]
+      (insert s :users {:name (str "name_" i)
+                        :city "Munich"
+                        :age  (int i)}))
+
+    (is (= (set (range 6 10))
+           (->> (select s :users
+                        (where [[= :city "Munich"]
+                                [> :age (int 5)]])
+                        (allow-filtering))
+                (map :age)
+                set))))
+
+  (deftest test-index-filtering-range-alt-syntax
+    (create-index s :city
+                  (new-query-api/on-table :users)
+                  (new-query-api/and-column :city))
     (create-index s :age
                   (new-query-api/on-table :users)
                   (new-query-api/and-column :age))
@@ -195,39 +215,29 @@
              (->> res
                   (map :age)
                   set))))
-    ;; (truncate s :users)
-    ))
-
-;; (deftest test-index-filtering-range-alt-syntax
-;;   (create-index s :users :city)
-;;   (create-index s :users :age)
-;;   (dotimes [i 10]
-;;     (insert s :users {:name (str "name_" i) :city "Munich" :age (int i)}))
-
-;;   (let [res (select s :users
-;;                     (where [[= :city "Munich"]
-;;                             [> :age (int 5)]])
-;;                     (allow-filtering true))]
-;;     (is (= (set (range 6 10))
-;;            (->> res
-;;                 (map :age)
-;;                 set))))
-;;   (truncate s :users))
-
-;; (deftest test-index-exact-match
-;;   (create-index s :users :city)
-;;   (dotimes [i 10]
-;;     (insert s :users {:name (str "name_" i) :city (str "city_" i) :age (int i)}))
-
-
-;;   (let [res (select s :users
-;;                     (where {:city "city_5"})
-;;                     (allow-filtering true))]
-;;     (is (= 5
-;;            (-> res
-;;                first
-;;                :age))))
-;;   (truncate s :users))
+    (truncate s :users))
+
+  (deftest test-index-exact-match
+    (create-index s :city
+                  (new-query-api/on-table :users)
+                  (new-query-api/and-column :city))
+    (create-index s :age
+                  (new-query-api/on-table :users)
+                  (new-query-api/and-column :age))
+
+    (dotimes [i 10]
+      (insert s :users {:name (str "name_" i)
+                        :city (str "city_" i)
+                        :age  (int i)}))
+
+    (let [res (select s :users
+                      (where {:city "city_5"})
+                      (allow-filtering))]
+      (is (= 5
+             (-> res
+                 first
+                 :age))))
+    (truncate s :users)))

 ;; (deftest test-select-where
 ;;   (insert s :users {:name "Alex"   :city "Munich"        :age (int 19)})


:nail_care:


Fix artifact input field.

Fix artifact input field.

--- src/cljs/hatnik/web/client/form_components.cljs
+++ src/cljs/hatnik/web/client/form_components.cljs
@@ -53,8 +53,7 @@
             (dom/input #js {:type "text"
                             :className "form-control"
                             :id "artifact-input"
-                            :placeholder "Artifact name"
-                            :value artifact}))
+                            :placeholder "Artifact name"}))
    (dom/div #js {:className "form-group"}
             (dom/label #js {:for "emain-input"} "Email")
             (dom/input #js {:type "email"


updated url.

updated url.

--- src/cljs/wombats_web_client/constants/urls.cljs
+++ src/cljs/wombats_web_client/constants/urls.cljs
@@ -1,7 +1,7 @@
 (ns wombats-web-client.constants.urls)

 ;; Remote Dev
-(def base-api-url "//dev.wombats.io")
+(def base-api-url "//dev.api.wombats.io")

 ;; Local Dev
 #_(def base-api-url "//localhost:8888")


Update documentation for model-gcis

Update documentation for model-gcis

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/dl/languages/exploration.clj
+++ src/conexp/contrib/dl/languages/exploration.clj
@@ -167,7 +167,8 @@
 ;;; gcis

 (defn model-gcis
-  "Returns a complete and sound set of gcis holding in model."
+  "Returns a complete and sound set of gcis holding in model. See
+  explore-model for valid args."
   [model & args]
   (binding [expert-refuses? (constantly false)]
     (apply explore-model model args)))


Working on quasiclosed sets

Working on quasiclosed sets

Removed implementation of pseudoclosure, since it was not correct (and
also could not be fixed easily.)

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/experimental/quasiclosed.clj
+++ src/conexp/contrib/experimental/quasiclosed.clj
@@ -22,8 +22,8 @@
   [ctx initial-set]
   (let [elements (vec initial-set),
         intent   (context-attribute-closure ctx initial-set),
-        result   (atom []),
-        search   (fn search [current i] ;this yields more than the direct generators
+        maximals (atom []),
+        search   (fn search [current i]
                    ;; invariant: current is always a set with the same
                    ;; intent as initial-set
                    (if (>= i (count elements))
@@ -31,11 +31,15 @@
                      (let [next (disj current (elements i))]
                        (if (not= (context-attribute-closure ctx next)
                                  intent)
-                         (swap! result conj next)
+                         (when (forall [x elements]
+                                 (=> (not (contains? next x))
+                                     (= intent
+                                        (context-attribute-closure ctx (conj next x)))))
+                           (swap! maximals conj next))
                          (search next (inc i)))
                        (search current (inc i)))))]
     (search initial-set 0)
-    @result))
+    @maximals))

 (defn context-attribute-quasiclosure
   "Computes the quasiclosure of set in context ctx."
@@ -49,6 +53,13 @@
       set
       (recur ctx quasiclosure))))

+(defn quasi-intents
+  "Returns the quasi-closed sets of attributes of the given context
+  ctx."
+  [ctx]
+  (all-closed-sets (attributes ctx)
+                   #(context-attribute-quasiclosure ctx %)))
+
 (defn quasi-stem-base
   "Returns the base of implications with quasiclosed premise."
   [ctx]
@@ -59,51 +70,7 @@
                       (make-implication set
                                         (context-attribute-closure ctx set)))))
            #{}
-           (all-closed-sets (attributes ctx)
-                            #(context-attribute-quasiclosure ctx %))))
-
-;;;
-
-;; (defn- context-attribute-pseudoclosure  ;this is wrong
-;;   "Returns the pseudoclosure of initial-set in context ctx."
-;;   [ctx initial-set]
-;;   (let [elements (vec initial-set),
-;;         intent   (context-attribute-closure ctx initial-set),
-;;         minimal-nongens (atom []),
-;;         search   (fn search [current i]
-;;                    (if (not= (context-attribute-closure ctx current)
-;;                              intent)
-;;                      nil
-;;                      (let [old @minimal-nongens]
-;;                        (doseq [j (range 0 (count elements))]
-;;                          (let [next (disj current (elements j))]
-;;                            (when (not= next current)
-;;                              (search next (inc j)))))
-;;                        (when (= old @minimal-nongens)
-;;                          (swap! minimal-nongens conj current)))))]
-;;     (search initial-set 0)
-;;     (println @minimal-nongens)
-;;     (if (empty? @minimal-nongens)
-;;       initial-set
-;;       (let [quasiclosed (map #(context-attribute-quasiclosure ctx %)
-;;                              @minimal-nongens)]
-;;         (println quasiclosed)
-;;         (if (not (exists [set quasiclosed] (proper-subset? set initial-set)))
-;;           (context-attribute-quasiclosure ctx initial-set)
-;;           intent)))))
-
-;; (defn pseudo-stem-base
-;;   "Returns the base of implications with pseudoclosed premise."
-;;   [ctx]
-;;   (reduce! (fn [impls set]
-;;              (if (= set (context-attribute-closure ctx set))
-;;                impls
-;;                (conj! impls
-;;                       (make-implication set
-;;                                         (context-attribute-closure ctx set)))))
-;;            #{}
-;;            (all-closed-sets (attributes ctx)
-;;                             #(context-attribute-pseudoclosure ctx %))))
+           (quasi-intents ctx)))

 ;;;


reader: add line/column info on vectors, maps and symbols

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -126,7 +126,7 @@

   IndexingReader
   (get-line-number [reader] (int (inc line)))
-  (get-column-number [reader]  (int column)))
+  (get-column-number [reader] (int column)))

 (extend-type java.io.PushbackReader
   Reader
@@ -214,7 +214,7 @@
   [rdr & msg]
   (throw (ex-info (apply str msg)
                   (merge {:type :reader-exception}
-                         (if (indexing-reader? rdr)
+                         (when (indexing-reader? rdr)
                            {:line (get-line-number rdr)
                             :column (get-column-number rdr)})))))

@@ -442,20 +442,29 @@
         the-list (read-delimited-list \) rdr true)]
     (if (empty? the-list)
       '()
-      (if-not line
-        (clojure.lang.PersistentList/create the-list)
-        (with-meta (clojure.lang.PersistentList/create the-list) {:line line :column column})))))
+      (with-meta (clojure.lang.PersistentList/create the-list)
+        (when line
+          {:line line :column column})))))

 (defn read-vector
   [rdr _]
-  (read-delimited-list \] rdr true))
+  (let [[line column] (when (indexing-reader? rdr)
+                        [(get-line-number rdr) (dec (get-column-number rdr))])
+        the-vector (read-delimited-list \] rdr true)]
+    (with-meta the-vector
+      (when line
+        {:line line :column column}))))

 (defn read-map
   [rdr _]
-  (let [l (to-array (read-delimited-list \} rdr true))]
+  (let [[line column] (when (indexing-reader? rdr)
+                        [(get-line-number rdr) (dec (get-column-number rdr))])
+        l (to-array (read-delimited-list \} rdr true))]
     (when (== 1 (bit-and (alength l) 1))
       (reader-error rdr "Map literal must contain an even number of forms"))
-    (RT/map l)))
+    (with-meta (RT/map l)
+      (when line
+        {:line line :column column}))))

 (defn read-number
   [reader initch]
@@ -507,20 +516,24 @@
 (defn read-symbol
   [rdr initch]
   (when-let [token (read-token rdr initch)]
-    (case token
-
-      ;; special symbols
-      "nil" nil
-      "true" true
-      "false" false
-      "/" '/
-      "NaN" Double/NaN
-      "-Infinity" Double/NEGATIVE_INFINITY
-      ("Infinity" "+Infinity") Double/POSITIVE_INFINITY
-
-      (or (when-let [p (parse-symbol token)]
-            (symbol (p 0) (p 1)))
-          (reader-error rdr "Invalid token: " token)))))
+    (let [[line column] (when (indexing-reader? rdr)
+                          [(get-line-number rdr) (dec (get-column-number rdr))])]
+      (case token
+
+        ;; special symbols
+        "nil" nil
+        "true" true
+        "false" false
+        "/" '/
+        "NaN" Double/NaN
+        "-Infinity" Double/NEGATIVE_INFINITY
+        ("Infinity" "+Infinity") Double/POSITIVE_INFINITY
+
+        (or (when-let [p (parse-symbol token)]
+              (with-meta (symbol (p 0) (p 1))
+                (when line
+                  {:line line :column column})))
+            (reader-error rdr "Invalid token: " token))))))

 (def ^:dynamic *alias-map* nil)
 (defn- resolve-ns [sym]


Add branching on nil exception to slf4j and commons-logging impls (already in place for others).

--- src/main/clojure/clojure/tools/logging/impl.clj
+++ src/main/clojure/clojure/tools/logging/impl.clj
@@ -55,14 +55,23 @@
            :write!
            (fn [^org.slf4j.Logger logger# level# ^Throwable e# msg#]
              (let [^String msg# (str msg#)]
-               (condp = level#
-                 :trace (.trace logger# msg# e#)
-                 :debug (.debug logger# msg# e#)
-                 :info  (.info  logger# msg# e#)
-                 :warn  (.warn  logger# msg# e#)
-                 :error (.error logger# msg# e#)
-                 :fatal (.error logger# msg# e#)
-                 (throw (IllegalArgumentException. (str level#))))))})
+               (if e#
+                 (condp = level#
+                   :trace (.trace logger# msg# e#)
+                   :debug (.debug logger# msg# e#)
+                   :info  (.info  logger# msg# e#)
+                   :warn  (.warn  logger# msg# e#)
+                   :error (.error logger# msg# e#)
+                   :fatal (.error logger# msg# e#)
+                   (throw (IllegalArgumentException. (str level#))))
+                 (condp = level#
+                   :trace (.trace logger# msg#)
+                   :debug (.debug logger# msg#)
+                   :info  (.info  logger# msg#)
+                   :warn  (.warn  logger# msg#)
+                   :error (.error logger# msg#)
+                   :fatal (.error logger# msg#)
+                   (throw (IllegalArgumentException. (str level#)))))))})
         (reify LoggerFactory
           (name [_#]
             "org.slf4j")
@@ -92,14 +101,23 @@
                 (throw (IllegalArgumentException. (str level#)))))
             :write!
             (fn [logger# level# e# msg#]
-              (condp = level#
-                :trace (.trace logger# msg# e#)
-                :debug (.debug logger# msg# e#)
-                :info  (.info  logger# msg# e#)
-                :warn  (.warn  logger# msg# e#)
-                :error (.error logger# msg# e#)
-                :fatal (.fatal logger# msg# e#)
-                (throw (IllegalArgumentException. (str level#)))))})
+              (if e#
+                (condp = level#
+                  :trace (.trace logger# msg# e#)
+                  :debug (.debug logger# msg# e#)
+                  :info  (.info  logger# msg# e#)
+                  :warn  (.warn  logger# msg# e#)
+                  :error (.error logger# msg# e#)
+                  :fatal (.fatal logger# msg# e#)
+                  (throw (IllegalArgumentException. (str level#))))
+                (condp = level#
+                  :trace (.trace logger# msg#)
+                  :debug (.debug logger# msg#)
+                  :info  (.info  logger# msg#)
+                  :warn  (.warn  logger# msg#)
+                  :error (.error logger# msg#)
+                  :fatal (.fatal logger# msg#)
+                  (throw (IllegalArgumentException. (str level#))))))})
          (reify LoggerFactory
            (name [_#]
              "org.apache.commons.logging")
@@ -133,9 +151,9 @@
               (let [level# (or
                              (levels# level#)
                              (throw (IllegalArgumentException. (str level#))))]
-                (if-not e#
-                  (.log logger# level# msg#)
-                  (.log logger# level# msg# e#))))})
+                (if e#
+                  (.log logger# level# msg# e#)
+                  (.log logger# level# msg#))))})
          (reify LoggerFactory
            (name [_#]
              "org.apache.log4j")


Reorganize imports on canvas ns.

Reorganize imports on canvas ns.

--- frontend/src/uxbox/main/ui/workspace/canvas.cljs
+++ frontend/src/uxbox/main/ui/workspace/canvas.cljs
@@ -10,11 +10,7 @@
             [lentes.core :as l]
             [goog.events :as events]
             [potok.core :as ptk]
-            [uxbox.util.geom.point :as gpt]
-            [uxbox.util.dom :as dom]
-            [uxbox.util.data :refer (parse-int)]
-            [uxbox.util.mixins :as mx :include-macros true]
-            [uxbox.util.rlocks :as rlocks]
+            [uxbox.store :as st]
             [uxbox.main.constants :as c]
             [uxbox.main.data.projects :as dp]
             [uxbox.main.data.workspace :as dw]
@@ -23,10 +19,16 @@
             [uxbox.main.ui.shapes :as uus]
             [uxbox.main.ui.shapes.selection :refer (selection-handlers)]
             [uxbox.main.ui.workspace.base :as wb]
+            [uxbox.main.ui.workspace.scroll :as scroll]
             [uxbox.main.ui.workspace.drawarea :refer (draw-area)]
             [uxbox.main.ui.workspace.ruler :refer (ruler)]
             [uxbox.main.ui.workspace.selrect :refer (selrect)]
-            [uxbox.main.ui.workspace.grid :refer (grid)])
+            [uxbox.main.ui.workspace.grid :refer (grid)]
+            [uxbox.util.geom.point :as gpt]
+            [uxbox.util.dom :as dom]
+            [uxbox.util.data :refer (parse-int)]
+            [uxbox.util.mixins :as mx :include-macros true]
+            [uxbox.util.rlocks :as rlocks])
   (:import goog.events.EventType))

 ;; --- Background


Tweaking description, UI

Tweaking description, UI

--- src/ui/relevance/display.cljs
+++ src/ui/relevance/display.cljs
@@ -304,8 +304,18 @@
     [:p "I wrote Relevance to help manage that. I've found it very useful in organizing what I should be focusing on, and I hope it'l be useful for you as well."]
     ]
    [:div {:class "col-sm-10 col-sm-offset-1"}
-    [:h2 "Preview software"]
-    [:p "Relevance is a software preview, and I'll be happy to hear your comments. If you have any suggestions on what you think might make Relevance better, "
+    [:h2 "Adaptive arrangements"]
+    [:p
+     "Relevance will periodically clean up sites that you haven't spent a long time at, or that you don't visit that often."
+     "This means you can always rely on the order to be based on fresh data from your recent behavior."]
+    [:p
+     "If you want to fine-tune which sites Relevance prioritizes, you can go to the "
+     [:i "Settings"]
+     " page and add domains that Relevance should ignore when recording your habits."]
+    ]
+   [:div {:class "col-sm-10 col-sm-offset-1"}
+    [:h2 "Notes and comments"]
+    [:p "I'm actively developing Relevance, and I'll be happy to hear your comments. If you have any suggestions on what you think might make Relevance better, "
      [:a {:href "https://twitter.com/intent/tweet?text=Hey%20@argesric%20about%20&hashtags=relevance" :target "_blank"}
       "please reach out on Twitter"]
      " or "
@@ -356,13 +366,18 @@
        [:div {:class "page-header"} [:h2 "Import data"]]
        [:div {:class "alert alert-warning"}
         [:h4 "Warning!"]
-        [:p "Your entire data will be replaced with the information below."]]
-       [:textarea {:class     "form-control"
-                   :rows      30
-                   :value     @import-data
-                   :on-change #(reset! import-data (-> % .-target .-value))}]
-       [:a {:class    "btn btn-primary btn-sm"
-            :on-click #(dispatch [:data-import @import-data])} "Import"]
+        [:p "Your reading statistics be replaced with the information you enter below."]]
+       [:div {:class "row"}
+        [:textarea {:class     "form-control"
+                    :rows      30
+                    :value     @import-data
+                    :on-change #(reset! import-data (-> % .-target .-value))}]
+        ]
+
+       [:div {:class "row"}
+        [:a {:class    "btn btn-primary btn-sm"
+             :on-click #(dispatch [:data-import @import-data])} "Import"]
+        ]
        ])))

 (defn div-settings []


CMR-1380: Minor update to string printed during database migration

--- metadata-db-app/src/config/mdb_migrate_helper.clj
+++ metadata-db-app/src/config/mdb_migrate_helper.clj
@@ -7,10 +7,10 @@
 (defn sql
   "Applies the sql update"
   [stmt-str]
-  (println "Applying update" stmt-str)
+  (println "Applying" stmt-str)
   (let [start-time (System/currentTimeMillis)]
     (j/db-do-commands (config/db) stmt-str)
-    (println (format "Finished update %s in [%s] ms."
+    (println (format "Finished %s in [%s] ms."
                      stmt-str
                      (- (System/currentTimeMillis) start-time)))))


CMR-1589: Changed filter not to remove

CMR-1589: Changed filter not to remove

--- metadata-db-app/src/config/mdb_migrate_helper.clj
+++ metadata-db-app/src/config/mdb_migrate_helper.clj
@@ -32,7 +32,7 @@
   "Gets a list of the regular (not small) providers in the datbase. Primarily for enabling
   migrations of existing provider tables."
   []
-  (filter #(not (:small %)) (p/get-providers (config/db))))
+  (remove :small (p/get-providers (config/db))))

 (defn get-regular-provider-collection-tablenames
   "Gets a list of all the collection tablenames for regular providers. Primarily for enabling


CMR-1862 Explains tiling system coordinate string parameters.

--- umm-spec-lib/src/cmr/umm_spec/iso19115_2_util.clj
+++ umm-spec-lib/src/cmr/umm_spec/iso19115_2_util.clj
@@ -34,7 +34,8 @@
   (clojure.set/map-invert iso-date-type-codes))

 (defn tiling-system-coding-params
-  "Returns ISO tiling system encoding string parameters for given tiling system map."
+  "Returns ISO tiling system encoding string parameters (coordinate 1 prefix, coordinate 2 prefix,
+  and range separator) for given tiling system map. The parameters are used by tiling-system-string."
   [tiling-system]
   (condp #(.contains %2 %1) (:TilingIdentificationSystemName tiling-system)
     "CALIPSO" ["o" "p" ","]


Registration available display fix

Registration available display fix

--- src/name_bazaar/ui/components/registrar_registration/general_info.cljs
+++ src/name_bazaar/ui/components/registrar_registration/general_info.cljs
@@ -17,7 +17,7 @@
      (-> props (dissoc :ens.record/name)
          (dissoc :name-bazaar-registrar.registration/owner))
      [:div [:b "Registrar Information"]]
-     [:div "Registration Available: " available]
+     [:div "Registration Available: " (case available true "Yes" false "No" "No Information")]
      [:div.ellipsis
       "Expiration Date: " (if expiration-date
                               (format-local-datetime expiration-date)


CMR-1747: Fixing problem in an old test.

--- system-int-test/test/cmr/system_int_test/search/paging_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/paging_search_test.clj
@@ -127,6 +127,23 @@
                  :else (compare (:revision-id c2) (:revision-id c1)))))
            collections))

+(defn sort-collections-latest-revisions
+  "Sorts a list of collections using the same default sort as search for latest revisions."
+  [collections]
+  (sort-by identity
+           (fn [c1 c2]
+             (let [et1 (:entry-title c1)
+                   et2 (:entry-title c2)
+                   p1 (:provider-id c1)
+                   p2 (:provider-id c2)
+                   seq1 (concept-id->sequence-number (:concept-id c1))
+                   seq2 (concept-id->sequence-number (:concept-id c2))]
+               (cond
+                 (not= et1 et2) (compare et1 et2)
+                 (not= p1 p2) (compare p1 p2)
+                 :else (compare seq1 seq2))))
+           collections))
+
 (defn select-page
   "Manually selects a page of collections."
   [collections page-num page-size]
@@ -159,16 +176,18 @@

 (deftest search-with-page-num
   (let [provider-id "PROV1"
-        [col1 col2 col3 col4 col5 col6 col7 col8 col9 col10] (for [n (range 10)]
-                                                               (d2c/ingest provider-id
-                                                                           (dc/collection {})))]
+        collections (doall (for [n (range 10)]
+                             (d2c/ingest provider-id
+                                         (dc/collection {}))))]
     (index/wait-until-indexed)
     (testing "Search with page_num."
       (let [{:keys [refs]} (search/find-refs :collection {:provider "PROV1"
                                                           :page_size 5
                                                           :page_num 2})]
-        (is (= (map :short-name [col5 col4 col3 col2 col1])
-               (map :short-name refs)))))
+        (is (= (map get-concept-id-revision-id (select-page (sort-collections-latest-revisions
+                                                              collections)
+                                                            2 5))
+               (map get-concept-id-revision-id refs)))))
     (testing "page_num less than one."
       (let [resp (search/find-refs :collection {:provider "PROV1"
                                                 :page_size 5


Story ID: RPC-236 Summary: TestSubResult -> ResultLine

--- src/untangled_spec/reporters/browser.cljs
+++ src/untangled_spec/reporters/browser.cljs
@@ -9,7 +9,7 @@

     [untangled-spec.reporters.impl.browser :as impl]))

-(defui TestSubResult
+(defui ResultLine
        Object
        (initLocalState [this] {:folded? true})
        (render [this]
@@ -27,16 +27,16 @@
                                                       (some-> value .-stack impl/stack->trace)))
                                    (dom/code nil (str value))))))))

-(def <test-sub-result> (om/factory TestSubResult))
+(def <result-line> (om/factory ResultLine))

 (defui TestResult
        Object
        (render [this]
                (let [{:keys [message actual expected]} (om/props this)]
                  (->> (dom/tbody nil
-                                 (<test-sub-result> {:title "Actual"
+                                 (<result-line> {:title "Actual"
                                                      :value actual})
-                                 (<test-sub-result> {:title "Expected"
+                                 (<result-line> {:title "Expected"
                                                      :value (or expected "")}))
                       (dom/table nil)
                       (dom/div nil (when message (dom/h3 nil message)))


DM #107 - Fix functional tests

DM #107 - Fix functional tests

--- test/objective8/functional/functional_tests.clj
+++ test/objective8/functional/functional_tests.clj
@@ -99,12 +99,12 @@
              (screenshot "create_objective_page")
              (wait-for-title "Create an Objective | Objective[8]")

-             (-> (wd/input-text ".func--input-objective-title" "A")
+             (-> (wd/input-text ".func--input-objective-title" "F")
                  (wd/submit))
              (wait-for-element ".func--objective-title-error")
              (screenshot "create_objective_invalid_title")

-             (wd/input-text ".func--input-objective-title" "Functional test headline")
+             (wd/input-text ".func--input-objective-title" "unctional test headline")
              (-> ".func--input-objective-background"
                  (wd/input-text
                    "Functional test description with lots of hipster-ipsum:


Update scala_test.clj

Update scala_test.clj

--- test/swagger_gen/rendering/scala_test.clj
+++ test/swagger_gen/rendering/scala_test.clj
@@ -23,5 +23,3 @@
     (is (= model1-expected (render-case-class model1)))
     (is (= model2-expected (render-case-class model2)))
     ))
-
-


Take all-terms from idf since they are conveniently calculated for us.

--- project/analyze-data/src/analyze_data/tf_idf/core.clj
+++ project/analyze-data/src/analyze_data/tf_idf/core.clj
@@ -69,8 +69,8 @@
   :tf-idf is a lazy sequence of core.matrix sparse arrays which contain the
           tf-idf values for each document in term-corpus."
   [term-corpus]
-  (let [all-terms (->> term-corpus (apply concat) (distinct) (sort))
-        idf (inverse-document-frequency term-corpus)
+  (let [idf (inverse-document-frequency term-corpus)
+        all-terms (sort (keys idf))
         tf-idf-values (map (partial tf-idf-document all-terms idf)
                            term-corpus)]
     {:all-terms all-terms


Round rather than truncating RGB values.

--- src/afterglow/controllers/color.clj
+++ src/afterglow/controllers/color.clj
@@ -66,11 +66,11 @@
                         (show/set-variable! variable
                                             (case component
                                               :red (colors/create-color
-                                                    (merge rgb {:r (colors/clamp-rgb-int (int value))}))
+                                                    (merge rgb {:r (colors/clamp-rgb-int (Math/round value))}))
                                               :green (colors/create-color
-                                                      (merge rgb {:g (colors/clamp-rgb-int (int value))}))
+                                                      (merge rgb {:g (colors/clamp-rgb-int (Math/round value))}))
                                               :blue (colors/create-color
-                                                     (merge rgb {:b (colors/clamp-rgb-int (int value))}))
+                                                     (merge rgb {:b (colors/clamp-rgb-int (Math/round value))}))
                                               :hue (colors/create-color (merge hsl {:h (colors/clamp-hue value)}))
                                               :saturation (colors/create-color
                                                            (merge hsl {:s (colors/clamp-percent-float value)}))


Remove unused import

Remove unused import

--- src/clj_gatling/simulation_util.clj
+++ src/clj_gatling/simulation_util.clj
@@ -3,8 +3,7 @@
             [clj-time.format :as f]
             [clojure.java.io :as io]
             [clojure.string :as str])
-  (:import [java.util List]
-           [java.io File]
+  (:import [java.io File]
            [java.io StringWriter PrintWriter]
            [clj_gatling.simulation_runners FixedRequestNumberRunner DurationRunner]))


Function get-list-of-all-jobs

Function get-list-of-all-jobs

--- src/clj_jenkins_api/jenkins_api.clj
+++ src/clj_jenkins_api/jenkins_api.clj
@@ -51,4 +51,14 @@
                     :trust-store "keystore"
                     :trust-store-pass "changeit"})))

+(defn read-list-of-all-jobs
+    "Read list of all jobs via Jenkins API."
+    [jenkins-url job-list-part]
+    (let [all-jobs-url (str jenkins-url job-list-part)]
+        (println "Using the following URL to retrieve all Jenkins jobs: " all-jobs-url)
+        (let [data (json/read-str (get-command all-jobs-url))]
+            (if data
+                (get data "jobs")
+                nil))))

+


Redraw the screen at current playback position when starting playback

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -87,7 +87,9 @@
                            (dispatch [:finished])
                            (print (str "finished in " (elapsed-time-since start)))))
           stop-playback-chan nil))) ; do nothing, break the loop
-    (assoc state :stop stop-fn)))
+    (-> state
+        (apply-changes (prev-changes (:frames state) play-from))
+        (assoc :stop stop-fn))))

 (defn stop-playback [state]
   (let [t ((:stop state))]


Intention is to leave truthy ones

Intention is to leave truthy ones

--- src/cljs/asciinema_player/view.cljs
+++ src/cljs/asciinema_player/view.cljs
@@ -19,7 +19,7 @@
         bg-class (if final-bg (str "bg-" final-bg))
         bold-class (if bold "bright")
         underline-class (if underline "underline")
-        classes (filter identity [fg-class bg-class bold-class underline-class])]
+        classes (filter boolean [fg-class bg-class bold-class underline-class])]
     (string/join " " classes)))

 (defn part [p]


Bring c.c.reducers up-to-date with changes in Clojure

--- src/cljs/clojure/core/reducers.cljs
+++ src/cljs/clojure/core/reducers.cljs
@@ -13,7 +13,7 @@
       dependency info."
       :author "Rich Hickey"}
   clojure.core.reducers
-  (:refer-clojure :exclude [reduce map filter remove take take-while drop flatten])
+  (:refer-clojure :exclude [reduce map mapcat filter remove take take-while drop flatten])
   (:require [clojure.walk :as walk]
             [cljs.core :as core]))

@@ -92,6 +92,17 @@
           ([ret k v]
              (f1 ret (f k v)))))))

+(defcurried mapcat
+  "Applies f to every value in the reduction of coll, concatenating the result
+  colls of (f val). Foldable."
+  {}
+  [f coll]
+  (folder coll
+   (fn [f1]
+     (rfn [f1 k]
+          ([ret k v]
+             (reduce f1 ret (f k v)))))))
+
 (defcurried filter
   "Retains values in the reduction of coll for which (pred val)
   returns logical true. Foldable."
@@ -104,6 +115,21 @@
              (if (pred k v)
                (f1 ret k v)
                ret))))))
+
+(defcurried flatten
+  "Takes any nested combination of sequential things (lists, vectors,
+  etc.) and returns their contents as a single, flat foldable
+  collection."
+  {}
+  [coll]
+  (folder coll
+   (fn [f1]
+     (fn
+       ([] (f1))
+       ([ret v]
+          (if (sequential? v)
+            (-reduce (flatten v) f1 ret)
+            (f1 ret v)))))))

 (defcurried remove
   "Removes values in the reduction of coll for which (pred val)
@@ -151,29 +177,6 @@
             (if (neg? @cnt)
               (f1 ret k v)
               ret)))))))
-
-(defcurried flatten
-  "Takes any nested combination of sequential things (lists, vectors,
-  etc.) and returns their contents as a single, flat foldable
-  collection."
-  {}
-  [coll]
-  (let [rf (fn [f1]
-             (fn
-               ([] (f1))
-               ([ret v]
-                  (if (sequential? v)
-                    (-reduce (flatten v) f1 ret)
-                    (f1 ret v)))))]
-    (reify
-     cljs.core/IReduce
-     (-reduce [this f1] (-reduce this f1 (f1)))
-     (-reduce [_  f1 init] (-reduce coll (rf f1) init))
-
-     #_
-     CollFold
-     #_
-     (coll-fold [_ n combinef reducef] (coll-fold coll n combinef (rf reducef))))))

 ;;do not construct this directly, use cat
 (deftype Cat [cnt left right]


Ensure "Normal" is the first syntax config (VIM)

--- src/cljs/koeeoadi/themebuilder.cljs
+++ src/cljs/koeeoadi/themebuilder.cljs
@@ -122,6 +122,11 @@
    "String"      "string"
    "Type"        "type"})

+(defn vim-position-normal [face-names]
+  "Moves the Normal syntax name to the beginning.  Needed for VIM
+   to set colors properly"
+  (sort-by #(not= "Normal" %) face-names))
+
 (defn vim-build-style [style-type prop-separator styles]
   (let [styles' (filter identity styles)]
     (if (empty? styles')
@@ -152,7 +157,7 @@
   (let [rec            @reconciler
         faces-by-name  (:faces/by-name rec)
         faces-by-name' (inject-bg-color-ident faces-by-name)
-        faces          (map #(vim-build-face % faces-by-name') (keys vim-face-map))
+        faces          (map #(vim-build-face % faces-by-name') (vim-position-normal (keys vim-face-map)))
         user-faces     (filter-by-editor :vim (vals (:user-faces/by-name rec)))
         all-faces      (sub-colors (concat faces user-faces))]
     (map vim-build-syntax-config-line all-faces)))


Fix deprecation doc

Fix deprecation doc

--- src/cljs/onyx_cheat_sheet/core.cljs
+++ src/cljs/onyx_cheat_sheet/core.cljs
@@ -187,12 +187,12 @@

 (defn deprecated-version [section k]
   (when-let [deprecated-version (get-in model [section :model k :deprecated-version])]
-    (r/alert {:bs-style "warning"}
+    (r/alert {:bs-style "danger"}
              [(dom/h5 {} "Deprecated Version")
               deprecated-version])))

 (defn deprecated-doc [section k]
-  (when-let [deprecation-doc (get-in model [section :model k :deprecated-doc])]
+  (when-let [deprecation-doc (get-in model [section :model k :deprecation-doc])]
     (r/alert {:bs-style "danger"}
              [(dom/h5 {} "Deprecation Doc")
               deprecation-doc])))


Fix model rendering, link anchors.

Fix model rendering, link anchors.

--- src/cljs/onyx_cheat_sheet/core.cljs
+++ src/cljs/onyx_cheat_sheet/core.cljs
@@ -219,13 +219,14 @@
                :id (str (keyword-sanitize-? k))}
               (dom/pre #js {:className "key-header"}
                        (dom/a #js {:href (str "#" (name section) "/" (keyword-sanitize-? k))}
-                              (dom/i #js {:className "glyphicon glyphicon-link"}))
+                              (dom/i #js {:className "fa fa-link"}))
                        (str k)
                        (if deprecated?
                          (r/badge {:class "deprecated-badge onyx-badge"} "deprecated"))
                        (requirements section k))
               (deprecated section k)
-              (r/well {:class "entry-doc"} (codify (get-in model [section :model k :doc])))
+              (when-let [doc (get-in model [section :model k :doc])]
+                (r/well {:class "entry-doc"} (codify doc)))
               (when-let [doc-url (get-in model [section :model k :doc-url])]
                 (dom/a #js {:href doc-url :target "_blank"} (str "Documentation")))
               (dom/p {})
@@ -261,7 +262,7 @@
                                 {:id "summary" :bs-style "primary" :class "summary-doc" :header (dom/h3 nil (str (model-names section) " Summary"))}
                                 (get-in model [section :summary])
                                 (dom/p {})
-                                (when-let [doc-url (get-in model [section :summary])]
+                                (when-let [doc-url (get-in model [section :doc-url])]
                                   (dom/a #js {:href doc-url} "Documentation"))))]
                            (for [k (model-display-order section)]
                              (dom/div (if (get-in model [section :model k]) #js {} #js {:style #js {:display "none"}})