Commit b45b7500 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #68 from thanosz/patch-1

Update StatsAction.java
parents f1ba423c ef38f144
...@@ -179,12 +179,19 @@ public class StatsAction { ...@@ -179,12 +179,19 @@ public class StatsAction {
format.setMaximumFractionDigits(0); format.setMaximumFractionDigits(0);
if(lows.length > 0) { if(lows.length > 0) {
if(type == Statistic.Type.count) { if(type == Statistic.Type.count) {
low = String.valueOf((int) lows[0]); double result = 0;
for (int i = 0; i < lows.length; i++ ) {
result += lows[i];
}
low = String.valueOf((int) result);
} }
else { else {
double l = lows[0]; double l = 0;
if(Double.isNaN(l)) { for (int i = 0; i < lows.length; i++ ) {
l = 0; if(Double.isNaN(lows[i])) {
lows[i] = 0;
}
l += lows[i];
} }
low = format.format(l); low = format.format(l);
} }
...@@ -195,12 +202,19 @@ public class StatsAction { ...@@ -195,12 +202,19 @@ public class StatsAction {
String high; String high;
if(highs.length > 0) { if(highs.length > 0) {
if(type == Statistic.Type.count) { if(type == Statistic.Type.count) {
high = String.valueOf((int) highs[0]); double result = 0;
for (int i=0; i < highs.length; i++ ) {
result += highs[i];
}
high = String.valueOf((int) result);
} }
else { else {
double h= highs[0]; double h= 0;
if(Double.isNaN(h)) { for (int i = 0; i < highs.length; i++) {
h = 0; if(Double.isNaN(highs[i])) {
highs[i] = 0;
}
h += highs[i];
} }
high = format.format(h); high = format.format(h);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment