aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Ockman2012-07-04 22:48:53 -0400
committerSam Ockman2012-07-04 22:48:53 -0400
commitd726a9e8299477a7cf2d3433d5f80c6e02a3df50 (patch)
treee5cf04a516e13c5d4563d2a1db85effd34a73e02
parent275174497daa6d0dae64124addb360cb8c71c658 (diff)
downloadgenenetwork2-d726a9e8299477a7cf2d3433d5f80c6e02a3df50.tar.gz
Before making checkmarks the default
-rw-r--r--wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee40
-rw-r--r--wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js39
2 files changed, 16 insertions, 63 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 d3b1051d..63d327b8 100644
--- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee
+++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee
@@ -3,70 +3,44 @@ console.log("start_b")
isNumber = (o) ->
return ! isNaN (o-0) && o != null
-console.log("isNumber 7:", isNumber(7))
-console.log("isNumber 13.1:", isNumber(13.1))
-console.log("isNumber x:", isNumber("x"))
-console.log("isNumber '9':", isNumber('9'))
-console.log("isNumber:", isNumber())
-
-
$ ->
hide_tabs = (start) ->
for x in [start..10]
$("#stats_tabs" + x).hide()
- console.log("hidden:", x)
- console.log("start_a")
hide_tabs(1)
- console.log("hidden?")
-
# Changes stats table between all, bxd only and non-bxd, etc.
stats_mdp_change = ->
- console.log("In stats_mdp_change")
selected = $(this).val()
- console.log("Change was:", selected)
hide_tabs(0)
$("#stats_tabs" + selected).show()
$(".stats_mdp").change(stats_mdp_change)
- console.log("tape")
-
mean = (the_values)->
total = 0
total += value for value in the_values
- console.log("yeap")
- console.log(total)
the_mean = total / the_values.length
- return the_mean.toFixed(2)
-
+ the_mean = the_mean.toFixed(2)
+ current_mean = parseFloat($("#mean_value").html).toFixed(2)
+ if the_mean != current_mean
+ $("#mean_value").html(the_mean).effect("highlight")
edit_data_change = ->
- console.log("In edit_data_change")
the_values = []
- #console.log($(this))
- #$(this).each (counter, element) =>
- # #console.log("counter is:" + counter)
- # console.log("element is:")
- # console.log(element)
- console.log("foo")
values = $('#primary').find(".edit_strain_value")
- console.log("values are:", values)
+ #console.log("values are:", values)
for value in values
- console.log(value)
real_value = $(value).val()
- #if real_value
- console.log(real_value)
+ console.log("parent is:", $(value).closest("tr"))
if isNumber(real_value) and real_value != ""
the_values.push(parseFloat(real_value))
- console.log(the_values)
the_mean = mean(the_values)
- console.log(the_mean)
- $("#mean_value").html(the_mean)
+
$('#primary').change(edit_data_change)
console.log("loaded")
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 eecc630f..c7fc428e 100644
--- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
+++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
@@ -8,72 +8,51 @@
return !isNaN((o - 0) && o !== null);
};
- console.log("isNumber 7:", isNumber(7));
-
- console.log("isNumber 13.1:", isNumber(13.1));
-
- console.log("isNumber x:", isNumber("x"));
-
- console.log("isNumber '9':", isNumber('9'));
-
- console.log("isNumber:", isNumber());
-
$(function() {
var edit_data_change, hide_tabs, mean, stats_mdp_change;
hide_tabs = function(start) {
var x, _i, _results;
_results = [];
for (x = _i = start; start <= 10 ? _i <= 10 : _i >= 10; x = start <= 10 ? ++_i : --_i) {
- $("#stats_tabs" + x).hide();
- _results.push(console.log("hidden:", x));
+ _results.push($("#stats_tabs" + x).hide());
}
return _results;
};
- console.log("start_a");
hide_tabs(1);
- console.log("hidden?");
stats_mdp_change = function() {
var selected;
- console.log("In stats_mdp_change");
selected = $(this).val();
- console.log("Change was:", selected);
hide_tabs(0);
return $("#stats_tabs" + selected).show();
};
$(".stats_mdp").change(stats_mdp_change);
- console.log("tape");
mean = function(the_values) {
- var the_mean, total, value, _i, _len;
+ var current_mean, the_mean, total, value, _i, _len;
total = 0;
for (_i = 0, _len = the_values.length; _i < _len; _i++) {
value = the_values[_i];
total += value;
}
- console.log("yeap");
- console.log(total);
the_mean = total / the_values.length;
- return the_mean.toFixed(2);
+ 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");
+ }
};
edit_data_change = function() {
var real_value, the_mean, the_values, value, values, _i, _len;
- console.log("In edit_data_change");
the_values = [];
- console.log("foo");
values = $('#primary').find(".edit_strain_value");
- console.log("values are:", values);
for (_i = 0, _len = values.length; _i < _len; _i++) {
value = values[_i];
- console.log(value);
real_value = $(value).val();
- console.log(real_value);
+ console.log("parent is:", $(value).closest("tr"));
if (isNumber(real_value) && real_value !== "") {
the_values.push(parseFloat(real_value));
}
}
- console.log(the_values);
- the_mean = mean(the_values);
- console.log(the_mean);
- return $("#mean_value").html(the_mean);
+ return the_mean = mean(the_values);
};
$('#primary').change(edit_data_change);
return console.log("loaded");