summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2008-06-06 19:30:34 +0000
committerDamien F. Katz <damien@apache.org>2008-06-06 19:30:34 +0000
commitcba120e5615e3d37de01bc63fbc8b325108276c5 (patch)
tree6068e470cbc98fec03b59b1e2b90a7c6d15e03f6 /share/www
parentb9abcb574ce9ee60c8816e913fbc886659920c6b (diff)
Added comments and clarity to the reduce/combine test. again
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@664093 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/couch_tests.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js
index 2d7aaa66..cbec817e 100644
--- a/share/www/script/couch_tests.js
+++ b/share/www/script/couch_tests.js
@@ -361,14 +361,11 @@ var tests = {
if (combine) {
// This is the combine phase, we are re-reducing previosuly returned
// reduce values.
-
for(var i in values) {
count = count + values[i].count;
total = total + values[i].total;
sqrTotal = sqrTotal + (values[i].sqrTotal * values[i].sqrTotal);
}
- var variance = (sqrTotal - ((total * total)/count)) / count;
- stdDeviation = Math.sqrt(variance);
}
else {
// This is the reduce phase, we are reducing over emitted values from
@@ -378,12 +375,13 @@ var tests = {
sqrTotal = sqrTotal + (values[i] * values[i])
}
count = values.length;
- var variance = (sqrTotal - ((total * total)/count)) / count;
- stdDeviation = Math.sqrt(variance);
}
- // the reduce results. It contains enough information to compute
- // further reduce results, and the final output values.
+ var variance = (sqrTotal - ((total * total)/count)) / count;
+ stdDeviation = Math.sqrt(variance);
+
+ // the reduce result. It contains enough information to combine with
+ // more reduce results, and the final output values.
return {"stdDeviation":stdDeviation,"count":count,
"total":total,"sqrTotal":sqrTotal};
};