FIX: ensures we have data to compute average (#7685)

FIX: ensures we have data to compute average (#7685)

diff --git a/app/assets/javascripts/admin/components/admin-report-table.js.es6 b/app/assets/javascripts/admin/components/admin-report-table.js.es6
index bba15f0..6e1e22c 100644
--- a/app/assets/javascripts/admin/components/admin-report-table.js.es6
+++ b/app/assets/javascripts/admin/components/admin-report-table.js.es6
@@ -31,9 +31,14 @@ export default Ember.Component.extend({
     return reportTotal && total && twoColumns;
   },
 
-  @computed("model.average", "totalsForSample.1.value", "twoColumns")
-  showAverage(reportAverage, totalValue, twoColumns) {
-    return reportAverage && totalValue && twoColumns;
+  @computed("model.{average,data}", "totalsForSample.1.value", "twoColumns")
+  showAverage(model, sampleTotalValue, hasTwoColumns) {
+    return (
+      model.average &&
+      model.data.length > 0 &&
+      sampleTotalValue &&
+      hasTwoColumns
+    );
   },
 
   @computed("totalsForSample.1.value", "model.data.length")

GitHub sha: 42832813

1 Like