Skip to content

Commit

Permalink
fix error with adding nUsers
Browse files Browse the repository at this point in the history
if acc is not defined or is a number (as with distance,duration,count), do not add nUsers
  • Loading branch information
JGreenlee committed Sep 19, 2024
1 parent 95dc523 commit 314af14
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion www/js/metrics/metricsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ export function sumMetricEntry<T extends MetricName>(entry: MetricEntry<T>, metr
acc = metrics_summaries.acc_value_of_metric(metricName, acc, entry[field]);
}
}
acc['nUsers'] = entry['nUsers'] || 1;
if (acc && typeof acc == 'object') {
acc['nUsers'] = entry['nUsers'] || 1;
}
return (acc || {}) as MetricValue<T extends `${infer U}` ? U : never>;
}

Expand Down

0 comments on commit 314af14

Please sign in to comment.