mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: correctly implements average for reports (#13447)
- Also now marks time_to_first_response as an averaged chart - Averaged charts will now be marked as such in the UI
This commit is contained in:
@@ -569,6 +569,13 @@ Report.reopenClass({
|
||||
!date.isSame(currentStart) &&
|
||||
!date.isBetween(currentStart, currentEnd)
|
||||
) {
|
||||
if (model.average) {
|
||||
const days = currentEnd.diff(currentStart, "day") + 1; // 1 to include start
|
||||
transformedData[currentIndex].y = parseFloat(
|
||||
(transformedData[currentIndex].y / days).toFixed(2)
|
||||
);
|
||||
}
|
||||
|
||||
currentIndex += 1;
|
||||
currentStart = currentStart.add(1, kind).startOf(isoKind);
|
||||
currentEnd = currentEnd.add(1, kind).endOf(isoKind);
|
||||
|
||||
@@ -131,6 +131,11 @@
|
||||
{{/if}}
|
||||
|
||||
{{#if isChartMode}}
|
||||
{{#if model.average}}
|
||||
<span class="average-chart">
|
||||
{{i18n "admin.dashboard.reports.average_chart_label"}}
|
||||
</span>
|
||||
{{/if}}
|
||||
<div class="chart-groupings">
|
||||
{{#each chartGroupings as |chartGrouping|}}
|
||||
{{d-button
|
||||
|
||||
Reference in New Issue
Block a user