From 27cb2bb37939370cc732df8e15fe9dadc0a38b83 Mon Sep 17 00:00:00 2001 From: Thomas Brooks Date: Wed, 26 Jun 2019 14:26:53 -0400 Subject: [PATCH 01/16] Enable error modal for sharing --- templates/spreadsheets/comparison.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/spreadsheets/comparison.html b/templates/spreadsheets/comparison.html index 18cf03d..7048a1b 100644 --- a/templates/spreadsheets/comparison.html +++ b/templates/spreadsheets/comparison.html @@ -12,6 +12,9 @@ PCA_HEIGHT = 800; PCA_SYMBOL = "M 0,-15 A 15,15 0 0,1 15,0 L 0,0 Z M 15,0 A 15,15 0 0,1 -15,0 A 15,15 0 0,1 0,-15 L 0,-10 A 10,10 0 0,0 -10,0 A 10,10 0 0,0 10,0"; $(document).ready(function () { + // Handles to the error-handling modal + nitecap_error = $("#error-modal"); + nitecap_error_message = $("#error-modal-message") spreadsheet_ids = {{ spreadsheet_ids | safe }}; From 42ec7663e7af12f667c413146558f56740b47a31 Mon Sep 17 00:00:00 2001 From: Thomas Brooks Date: Wed, 26 Jun 2019 14:38:56 -0400 Subject: [PATCH 02/16] Display error modals on Ajax failures --- templates/spreadsheets/comparison.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/templates/spreadsheets/comparison.html b/templates/spreadsheets/comparison.html index 7048a1b..b2cae61 100644 --- a/templates/spreadsheets/comparison.html +++ b/templates/spreadsheets/comparison.html @@ -30,6 +30,9 @@ error: function(error) { console.log("Error loading spreadsheets"); console.log(error); + + nitecap_error_message.text("Error loading spreadsheets"); + nitecap_error.modal(); } }); @@ -104,6 +107,9 @@ error: function(error) { console.log("Error loading JTK values"); console.log(error); + + nitecap_error_message.text("Error loading JTK values"); + nitecap_error.modal(); } }); @@ -143,7 +149,9 @@ error: function(error) { console.log("Error loading upside values"); console.log(error); - response = error.responseText; + + nitecap_error_message.text("Error loading comparison statistics"); + nitecap_error.modal(); } }); } @@ -1311,8 +1319,9 @@ error: function (error) { console.log("Error running PCA"); console.log(error); - alert.text(error.responseText); - alert.show(); + + nitecap_error_message.text("Error running PCA"); + nitecap_error.modal(); }, complete: function() { vm.pca.running = false; From da103c4b46b3d91c6d729fb1bb7e3809c0108b13 Mon Sep 17 00:00:00 2001 From: Thomas Brooks Date: Wed, 26 Jun 2019 14:58:43 -0400 Subject: [PATCH 03/16] Handle null q-values in sorting rows --- templates/spreadsheets/comparison.html | 28 +++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/templates/spreadsheets/comparison.html b/templates/spreadsheets/comparison.html index b2cae61..29bdcc6 100644 --- a/templates/spreadsheets/comparison.html +++ b/templates/spreadsheets/comparison.html @@ -583,7 +583,8 @@ description: "Nitecap significance of rhythmicity for primary dataset.", per_spreadsheet: true, num_spreadsheets:'any', - sort_value:'tds'}, + sort_value:'tds', + secondary_sort_value:'qs'}, {name: "JTK", value: {p: "jtk_ps", q: "jtk_qs"}, @@ -1415,16 +1416,29 @@ }, sort_function: function () { + // We sort by the value specified in sort_by + // We also have a 'secondary sort value' which is used purely as a null/not-null check + // So if secondary sort value is null then we will sort the value to the end as if the main value were null + // This solves the problem where q-values are null and being sorted to the front of the list particulary + // from filters re-running q-values (which nulls them if filtered) and then being viewed without that filter let vm = this; let sorter = null; let value = null; + let secondary_value = null; if (this.sort_by.stat.sort_value !== undefined) { value = this.sort_by.stat.sort_value; + if (this.sort_by.stat.secondary_sort_value !== undefined) { + secondary_value = this.sort_by.stat.secondary_sort_value; + } else { + secondary_value = value; + } } else if (typeof this.sort_by.stat.value === 'string') { value = this.sort_by.stat.value; + secondary_value = value; } else { value = this.sort_by.stat.value.p; + secondary_value = this.sort_by.stat.value.q; } let sort_direction = 1; @@ -1434,16 +1448,20 @@ if (vm.sort_by.spreadsheet_num !== undefined) { sorter = function (i,j) { - let a = vm.spreadsheets[vm.sort_by.spreadsheet_num][value][i]; - let b = vm.spreadsheets[vm.sort_by.spreadsheet_num][value][j]; + let a = vm.spreadsheets[vm.sort_by.spreadsheet_num][secondary_value][i] && + vm.spreadsheets[vm.sort_by.spreadsheet_num][value][i]; + let b = vm.spreadsheets[vm.sort_by.spreadsheet_num][secondary_value][j] && + vm.spreadsheets[vm.sort_by.spreadsheet_num][value][j]; return compare(a ? a * sort_direction : a, // multiply by +/- 1 but not if null b ? b * sort_direction : b, i, j); }; } else { sorter = function (i,j) { - let a = vm.stats[value][i]; - let b = vm.stats[value][j]; + let a = vm.stats[secondary_value][i] + && vm.stats[value][i]; + let b = vm.stats[secondary_value][j] + && vm.stats[value][j]; return compare(a ? a * sort_direction : b, // multiply by +/- 1 but not if null b ? b * sort_direction : b, i, j); From fbbf4660ead9c6dac96cf5226cf0dbfaeaf0255b Mon Sep 17 00:00:00 2001 From: Thomas Brooks Date: Mon, 1 Jul 2019 10:41:40 -0400 Subject: [PATCH 04/16] Make stats look clickable --- static/css/main.css | 4 ++++ templates/spreadsheets/comparison.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/static/css/main.css b/static/css/main.css index c6cc27c..3a46653 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -194,6 +194,10 @@ body { color: #FFF; } +.stats-box td { + cursor: pointer; +} + #spreadsheetTable.dataTable tr.selected td.select-checkbox::after, #spreadsheetTable.dataTable tr.selected th.select-checkbox::after { font-family: "Font Awesome 5 Free"; content: "\f14a"; diff --git a/templates/spreadsheets/comparison.html b/templates/spreadsheets/comparison.html index 29bdcc6..c7fdf78 100644 --- a/templates/spreadsheets/comparison.html +++ b/templates/spreadsheets/comparison.html @@ -303,7 +303,7 @@

Spreadsheet Viewer

Secondary - +