about summary refs log tree commit diff
diff options
context:
space:
mode:
authorzsloan2020-09-10 14:54:57 -0500
committerzsloan2020-09-10 14:54:57 -0500
commit03240c4d22e894b977f7a1a2204a32408245c470 (patch)
treeddb7b936e635c0645d810668cc60bce968454b4a
parent657ab53bef4fc767fdc549f004153a7910b45bd0 (diff)
downloadgenenetwork2-03240c4d22e894b977f7a1a2204a32408245c470.tar.gz
Modified "natural-minus-na" sort function to treat an array of values
as equivalent to "N/A" (since different tables sometimes include other
values that imply there's no value) and applied it to some extra columns
in the Interval Analyst table
* wqflask/wqflask/static/new/javascript/search_results.js - Modified
sort_NAs function to take an array of "N/A"-equivalent values instead of
just comparing against the string "N/A"
* wqflask/wqflask/templates/mapping_results.html - Applied
"natural-minus-na" sort method to several columns that include "--" in
the Interval Analyst table
-rw-r--r--wqflask/wqflask/static/new/javascript/search_results.js8
-rw-r--r--wqflask/wqflask/templates/mapping_results.html6
2 files changed, 8 insertions, 6 deletions
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js
index b696dc4d..685d6291 100644
--- a/wqflask/wqflask/static/new/javascript/search_results.js
+++ b/wqflask/wqflask/static/new/javascript/search_results.js
@@ -259,14 +259,16 @@ $(function() {
   let naturalAsc = $.fn.dataTableExt.oSort["natural-ci-asc"]
   let naturalDesc = $.fn.dataTableExt.oSort["natural-ci-desc"]
 
+  let na_equivalent_vals = ["N/A", "--", ""]; //ZS: Since there are multiple values that should be treated the same as N/A
+
   function sort_NAs(a, b, sort_function){
-    if (a === "N/A" && b === "N/A") {
+    if ( na_equivalent_vals.includes(a) && na_equivalent_vals.includes(b)) {
       return 0;
     }
-    if (a === "N/A"){
+    if (na_equivalent_vals.includes(a)){
       return 1
     }
-    if (b === "N/A") {
+    if (na_equivalent_vals.includes(b)) {
       return -1;
     }
     return sort_function(a, b)
diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html
index 9c170494..4ea7fa07 100644
--- a/wqflask/wqflask/templates/mapping_results.html
+++ b/wqflask/wqflask/templates/mapping_results.html
@@ -402,9 +402,9 @@
                     { "type": "natural" , "orderDataType": "dom-inner-text" },
                     { "type": "natural" },
                     { "type": "natural" },
-                    { "type": "natural" },
-                    { "type": "natural" },
-                    { "type": "natural" , "orderDataType": "dom-inner-text" },
+                    { "type": "natural-minus-na" },
+                    { "type": "natural-minus-na" },
+                    { "type": "natural-minus-na" , "orderDataType": "dom-inner-text" },
                     { "type": "natural" }
                 ],
                 "columnDefs": [ {