From 30758c9aa11f494c6e566a9e7775fe0f0e27f45a Mon Sep 17 00:00:00 2001 From: Sam Ockman Date: Wed, 4 Jul 2012 23:58:55 -0400 Subject: Before rethinking tables --- .../new/javascript/trait_data_and_analysis.coffee | 18 +++++++++++++++-- .../new/javascript/trait_data_and_analysis.js | 23 +++++++++++++++++----- .../wqflask/templates/trait_data_and_analysis.html | 6 +++--- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee index 63d327b8..380d0a5a 100644 --- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee +++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee @@ -29,6 +29,14 @@ $ -> if the_mean != current_mean $("#mean_value").html(the_mean).effect("highlight") + n_of_samples = the_values.length + current_n_of_samples = $("#n_of_samples_value").html() + console.log("cnos:", current_n_of_samples) + console.log("n_of_samples:", n_of_samples) + if n_of_samples != current_n_of_samples + $("#n_of_samples_value").html(current_n_of_samples).effect("highlight") + + edit_data_change = -> the_values = [] @@ -36,10 +44,16 @@ $ -> #console.log("values are:", values) for value in values real_value = $(value).val() - console.log("parent is:", $(value).closest("tr")) + #console.log("parent is:", $(value).closest("tr")) + row = $(value).closest("tr") + checkbox = $(row).find(".edit_strain_checkbox") + checked = $(checkbox).attr('checked') + if not checked + console.log("Not checked") + continue if isNumber(real_value) and real_value != "" the_values.push(parseFloat(real_value)) - the_mean = mean(the_values) + mean(the_values) $('#primary').change(edit_data_change) diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js index c7fc428e..1ea224b4 100644 --- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js +++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js @@ -27,7 +27,7 @@ }; $(".stats_mdp").change(stats_mdp_change); mean = function(the_values) { - var current_mean, the_mean, total, value, _i, _len; + var current_mean, current_n_of_samples, n_of_samples, the_mean, total, value, _i, _len; total = 0; for (_i = 0, _len = the_values.length; _i < _len; _i++) { value = the_values[_i]; @@ -37,22 +37,35 @@ the_mean = the_mean.toFixed(2); current_mean = parseFloat($("#mean_value").html).toFixed(2); if (the_mean !== current_mean) { - return $("#mean_value").html(the_mean).effect("highlight"); + $("#mean_value").html(the_mean).effect("highlight"); + } + n_of_samples = the_values.length; + current_n_of_samples = $("#n_of_samples_value").html(); + console.log("cnos:", current_n_of_samples); + console.log("n_of_samples:", n_of_samples); + if (n_of_samples !== current_n_of_samples) { + return $("#n_of_samples_value").html(current_n_of_samples).effect("highlight"); } }; edit_data_change = function() { - var real_value, the_mean, the_values, value, values, _i, _len; + var checkbox, checked, real_value, row, the_values, value, values, _i, _len; the_values = []; values = $('#primary').find(".edit_strain_value"); for (_i = 0, _len = values.length; _i < _len; _i++) { value = values[_i]; real_value = $(value).val(); - console.log("parent is:", $(value).closest("tr")); + row = $(value).closest("tr"); + checkbox = $(row).find(".edit_strain_checkbox"); + checked = $(checkbox).attr('checked'); + if (!checked) { + console.log("Not checked"); + continue; + } if (isNumber(real_value) && real_value !== "") { the_values.push(parseFloat(real_value)); } } - return the_mean = mean(the_values); + return mean(the_values); }; $('#primary').change(edit_data_change); return console.log("loaded"); diff --git a/wqflask/wqflask/templates/trait_data_and_analysis.html b/wqflask/wqflask/templates/trait_data_and_analysis.html index c27ab092..1916a10c 100644 --- a/wqflask/wqflask/templates/trait_data_and_analysis.html +++ b/wqflask/wqflask/templates/trait_data_and_analysis.html @@ -289,7 +289,7 @@ N of Samples - {{ sd.N }} + {{ sd.N }} @@ -301,7 +301,7 @@ Median - {{ "%2.3f" % sd.traitmedian }} + {{ "%2.3f" % sd.traitmedian }} @@ -3066,7 +3066,7 @@ {{ loop.index }} - + -- cgit v1.2.3