aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Ockman2012-07-04 23:58:55 -0400
committerSam Ockman2012-07-04 23:58:55 -0400
commit30758c9aa11f494c6e566a9e7775fe0f0e27f45a (patch)
treeddc68e56f2c78d32640259bba5a31e03d5a84cd0
parentd726a9e8299477a7cf2d3433d5f80c6e02a3df50 (diff)
downloadgenenetwork2-30758c9aa11f494c6e566a9e7775fe0f0e27f45a.tar.gz
Before rethinking tables
-rw-r--r--wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee18
-rw-r--r--wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js23
-rw-r--r--wqflask/wqflask/templates/trait_data_and_analysis.html6
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 @@
<tr align="right">
<td class="fs13 b1 cbw c222" align="left">N of Samples</td>
- <td class="fs13 b1 cbw c222" nowrap="yes">{{ sd.N }}</td>
+ <td class="fs13 b1 cbw c222" nowrap="yes" id="n_of_samples_value">{{ sd.N }}</td>
</tr>
<tr align="right">
@@ -301,7 +301,7 @@
<tr align="right">
<td class="fs13 b1 cbw c222" nowrap="yes" align="left">Median</td>
- <td class="fs13 b1 cbw c222" nowrap="yes">{{ "%2.3f" % sd.traitmedian }}</td>
+ <td class="fs13 b1 cbw c222" nowrap="yes" id="median_value">{{ "%2.3f" % sd.traitmedian }}</td>
</tr>
<tr align="right">
@@ -3066,7 +3066,7 @@
<tr class="{{ strain.outlier }} value_se" id="{{ strain.the_id }}">
<td class="fs13 b1 c222" align="right" width="45">
{{ loop.index }}
- <input type="checkbox" name="selectCheck" class="checkbox edit_strain_checkbox" value="{{ strain.strain_name }}">
+ <input type="checkbox" name="selectCheck" class="checkbox edit_strain_checkbox" value="{{ strain.strain_name }}" checked="checked">
</td>
<td class="fs13 b1 c222" align="right" width="100">