Browse Source

fix(dashboard): Add initial value to reduce call

Michael Bromley 4 months ago
parent
commit
9261f03cbb
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/dashboard/plugin/config/metrics-strategies.ts

+ 1 - 1
packages/dashboard/plugin/config/metrics-strategies.ts

@@ -40,7 +40,7 @@ export class AverageOrderValueMetric implements MetricCalculation {
                 value: 0,
             };
         }
-        const total = data.orders.map(o => o.totalWithTax).reduce((_total, current) => _total + current);
+        const total = data.orders.map(o => o.totalWithTax).reduce((_total, current) => _total + current, 0);
         const average = Math.round(total / data.orders.length);
         return {
             label,