From 21f8d536207c851545b7b3eb31df685bc636b20a Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 11 Nov 2016 16:36:20 +0000 Subject: Fixed error causing correlation matrix page to not work with 2 traits (related to factor loadings table) Also improved factor loads table to show only two factors when there are two traits Fixed error related to get_traits_from_collections.js being called in collections/list before jquery is defined --- wqflask/wqflask/correlation_matrix/show_corr_matrix.py | 6 +++++- .../static/new/javascript/get_traits_from_collection.js | 12 +++++------- wqflask/wqflask/templates/collections/list.html | 7 +++---- wqflask/wqflask/templates/correlation_matrix.html | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index 70e21917..630980c7 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -207,7 +207,11 @@ class CorrelationMatrix(object): print("before loop:", self.loadings[0]) for i in range(len(self.trait_list)): loadings_row = [] - for j in range(3): + if len(self.trait_list) > 2: + the_range = 3 + else: + the_range = 2 + for j in range(the_range): position = i + len(self.trait_list)*j loadings_row.append(self.loadings[0][position]) loadings_array.append(loadings_row) diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js index a73eafe4..bcd83889 100644 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js @@ -226,10 +226,8 @@ back_to_collections = function() { return $('#collections_holder').colorbox.resize(); }; -$(function() { - console.log("inside get_traits_from_collection"); - $(document).on("click", ".collection_line", collection_click); - $(document).on("click", "#submit", submit_click); - $(document).on("click", ".trait", trait_click); - return $(document).on("click", "#back_to_collections", back_to_collections); -}); +console.log("inside get_traits_from_collection"); +$(".collection_line").on("click", collection_click); +$("#submit").on("click", submit_click); +$(".trait").on("click", trait_click); +$("#back_to_collections").on("click", back_to_collections); \ No newline at end of file diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index 23e976e9..e38b32a0 100644 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -54,10 +54,6 @@ {% endfor %} - - {# if "color_by_trait" in params #} - - {# endif #} @@ -78,6 +74,9 @@ + {% if "color_by_trait" in params %} + + {% endif %}