FIX: don't divide by 0, it's never worth it

This commit is contained in:
Régis Hanol
2015-08-10 10:06:33 +02:00
parent 139314c213
commit 80e6f54198

View File

@@ -26,7 +26,7 @@ const Report = Discourse.Model.extend({
count++; count++;
} }
}); });
if (this.get("method") === "average") { sum /= count; } if (this.get("method") === "average" && count > 0) { sum /= count; }
return round(sum, -2); return round(sum, -2);
} }
}, },