mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 13:52:50 +08:00
correct daily engaged users to look at average
This commit is contained in:
parent
a28c58feb1
commit
eb33f6e9b9
|
@ -33,6 +33,7 @@ export default Ember.Component.extend(AsyncReport, {
|
|||
backgroundColor: "rgba(200,220,240,0.3)",
|
||||
borderColor: "#08C",
|
||||
average: false,
|
||||
percent: false,
|
||||
total: 0,
|
||||
|
||||
@computed("dataSourceName")
|
||||
|
@ -142,6 +143,7 @@ export default Ember.Component.extend(AsyncReport, {
|
|||
this.get("startDate").isSame(this.get("endDate"), "day");
|
||||
|
||||
report.set("average", this.get("average"));
|
||||
report.set("percent", this.get("percent"));
|
||||
this.setProperties({ oneDataPoint, report });
|
||||
},
|
||||
|
||||
|
|
|
@ -177,9 +177,11 @@ const Report = Discourse.Model.extend({
|
|||
|
||||
if (this.get('average')) {
|
||||
prev = prev ? prev.toFixed(1) : "0";
|
||||
if (this.get('percent')) {
|
||||
current += '%';
|
||||
prev += '%';
|
||||
}
|
||||
}
|
||||
|
||||
return I18n.t('admin.dashboard.reports.trend_title', {percent: percent, prev: prev, current: current});
|
||||
},
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="chart-trend {{trend}}">
|
||||
{{#if average}}
|
||||
<span title="{{report.trendTitle}}">
|
||||
{{report.currentAverage}}%
|
||||
{{report.currentAverage}}{{if percent "%"}}
|
||||
</span>
|
||||
{{else}}
|
||||
<span title="{{report.trendTitle}}">
|
||||
|
|
|
@ -38,11 +38,13 @@
|
|||
{{dashboard-mini-chart
|
||||
dataSourceName="dau_by_mau"
|
||||
average=true
|
||||
percent=true
|
||||
startDate=startDate
|
||||
endDate=endDate}}
|
||||
|
||||
{{dashboard-mini-chart
|
||||
dataSourceName="daily_engaged_users"
|
||||
average=true
|
||||
startDate=startDate
|
||||
endDate=endDate}}
|
||||
|
||||
|
|
|
@ -188,7 +188,12 @@ class Report
|
|||
|
||||
if report.facets.include?(:prev_period)
|
||||
prev_data = UserAction.count_daily_engaged_users(report.start_date - (report.end_date - report.start_date), report.start_date)
|
||||
report.prev_period = prev_data.sum { |k, v| v }
|
||||
|
||||
prev = prev_data.sum { |k, v| v }
|
||||
if prev > 0
|
||||
prev = prev / ((report.end_date - report.start_date) / 1.day)
|
||||
end
|
||||
report.prev_period = prev
|
||||
end
|
||||
|
||||
data.each do |key, value|
|
||||
|
|
Loading…
Reference in New Issue
Block a user