FIX: better handling of no prev30Days (#6301)

This commit is contained in:
Joffrey JAFFEUX 2018-08-22 18:00:11 +02:00 committed by GitHub
parent f01169d6ff
commit c08dea386b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 3 deletions

View File

@ -439,7 +439,7 @@ const Report = Discourse.Model.extend({
case "high-trending-down":
return higherIsBetter ? "angle-double-down" : "angle-double-up";
default:
return null;
return "minus";
}
}
});

View File

@ -16,5 +16,9 @@
</div>
<div class="cell value thirty-days-count {{model.thirtyDaysTrend}}" title={{model.thirtyDaysCountTitle}}>
{{number model.lastThirtyDaysCount}} {{d-icon model.thirtyDaysTrendIcon}}
{{number model.lastThirtyDaysCount}}
{{#if model.prev30Days}}
{{d-icon model.thirtyDaysTrendIcon}}
{{/if}}
</div>

View File

@ -59,6 +59,9 @@
&.no-change {
color: $primary-medium;
i {
display: none;
}
}
.value {

View File

@ -34,6 +34,13 @@
}
}
&.no-change {
i {
color: $primary-medium;
font-size: $font-down-3;
}
}
&.high-trending-up,
&.trending-up {
i {

View File

@ -217,8 +217,9 @@ class Report
report.icon = 'user'
basic_report_about report, UserVisit, :by_day, report.start_date, report.end_date, report.group_id
add_counts report, UserVisit, 'visited_at'
report.prev30Days = UserVisit.where(mobile: true).where("visited_at >= ? and visited_at < ?", report.start_date - 30.days, report.start_date).count
end
def self.report_mobile_visits(report)