ソースを参照

fix(dashboard): Add initial value to reduce call

Michael Bromley 5 ヶ月 前
コミット
9261f03cbb
1 ファイル変更1 行追加1 行削除
  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,
                 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);
         const average = Math.round(total / data.orders.length);
         return {
         return {
             label,
             label,