aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2022-01-26 19:36:38 +0000
committerzsloan2022-01-27 13:45:09 -0600
commit6ab213921932d904c64c8b37a327a971a3c46cfc (patch)
tree41c5910d3f7547b4dabbe341449c432253f085fd /wqflask
parente374cac6eec2d05345d6f7a05061ee38a63db9f1 (diff)
downloadgenenetwork2-6ab213921932d904c64c8b37a327a971a3c46cfc.tar.gz
Replaced a confusing for loop with something that is (hopefully) easier to read and explicitly inverts start_index and end_index when the former is greater than the latter
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/search_results.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js
index 7124151e..a665e3d2 100644
--- a/wqflask/wqflask/static/new/javascript/search_results.js
+++ b/wqflask/wqflask/static/new/javascript/search_results.js
@@ -102,7 +102,13 @@ $(function() {
try {
start_index = parseInt(index_set.split("-")[0]);
end_index = parseInt(index_set.split("-")[1]);
- for (index = _j = start_index; start_index <= end_index ? _j <= end_index : _j >= end_index; index = start_index <= end_index ? ++_j : --_j) {
+
+ // If start index is higher than end index (for example is the string "10-5" exists) swap values so it'll be interpreted as "5-10" instead
+ if (start_index > end_index) {
+ [start_index, end_index] = [end_index, start_index]
+ }
+
+ for (index = start_index; index <= end_index; index++) {
index_list.push(index);
}
} catch (_error) {