aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js')
-rw-r--r--wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js95
1 files changed, 67 insertions, 28 deletions
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 e9a141a3..035b5c09 100644
--- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
+++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
@@ -1,11 +1,11 @@
// Generated by CoffeeScript 1.3.3
(function() {
- var isNumber,
+ var is_number,
__slice = [].slice;
console.log("start_b");
- isNumber = function(o) {
+ is_number = function(o) {
return !isNaN((o - 0) && o !== null);
};
@@ -28,44 +28,81 @@
};
$(".stats_mdp").change(stats_mdp_change);
mean = function(the_values) {
- 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];
- total += value;
- }
- the_mean = total / the_values.length;
- 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");
- }
- 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");
+ var category, current_mean, current_n_of_samples, id, in_box, n_of_samples, the_mean, total, value, _i, _j, _len, _len1, _ref, _ref1, _results;
+ _ref = ['primary', 'other', 'all'];
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ category = _ref[_i];
+ id = "#" + process_id(category, "mean");
+ console.log("id:", id);
+ total = 0;
+ _ref1 = the_values[category];
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
+ value = _ref1[_j];
+ total += value;
+ }
+ the_mean = total / the_values[category].length;
+ the_mean = the_mean.toFixed(2);
+ console.log("aaa");
+ in_box = $(id).html;
+ console.log("in_box:", in_box);
+ current_mean = parseFloat($(in_box)).toFixed(2);
+ console.log("the_mean:", the_mean);
+ console.log("current_mean:", current_mean);
+ console.log("aab");
+ if (the_mean !== current_mean) {
+ console.log("setting mean");
+ $(id).html(the_mean);
+ console.log("should be set");
+ }
+ if (current_mean && the_mean !== current_mean) {
+ $(id).effect("highlight");
+ }
+ n_of_samples = the_values[category].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) {
+ _results.push($("#n_of_samples_value").html(current_n_of_samples).effect("highlight"));
+ } else {
+ _results.push(void 0);
+ }
}
+ return _results;
};
edit_data_change = function() {
- var checkbox, checked, real_value, row, the_values, value, values, _i, _len;
- the_values = [];
- values = $('#primary').find(".edit_strain_value");
+ var category, checkbox, checked, real_value, row, the_values, value, values, _i, _len;
+ the_values = {
+ primary: [],
+ other: [],
+ all: []
+ };
+ console.log("at beginning:", the_values);
+ values = $('#value_table').find(".edit_strain_value");
for (_i = 0, _len = values.length; _i < _len; _i++) {
value = values[_i];
real_value = $(value).val();
row = $(value).closest("tr");
+ console.log("row is:", row);
+ console.log("row[0].id is:", row[0].id);
+ category = row[0].id;
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));
+ if (is_number(real_value) && real_value !== "") {
+ real_value = parseFloat(real_value);
+ if (_(category).startsWith("Primary")) {
+ the_values.primary.push(real_value);
+ } else if (_(category).startsWith("Other")) {
+ the_values.other.push(real_value);
+ }
+ the_values.all.push(real_value);
}
}
+ console.log("torwads end:", the_values);
return mean(the_values);
};
make_table = function() {
@@ -108,7 +145,7 @@
console.log("apple:", column);
the_id = process_id(column.t, row.vn);
console.log("the_id:", the_id);
- row_line += "<td id=\"" + the_id + "\">&nbsp;</td>";
+ row_line += "<td id=\"" + the_id + "\">foo</td>";
}
row_line += "</tr>";
console.log("row line:", row_line);
@@ -131,16 +168,18 @@
console.log("value:", value);
value = value.replace(" ", "_");
if (processed.length) {
- processed += ":";
+ processed += "-";
}
processed += value;
}
return processed;
};
- $('#primary').change(edit_data_change);
+ _.mixin(_.str.exports());
+ $('#value_table').change(edit_data_change);
console.log("loaded");
console.log("basic_table is:", basic_table);
make_table();
+ edit_data_change();
return console.log("end");
});