FIX: remove category filter from page view reports

This commit is contained in:
Arpit Jalan 2016-05-09 13:16:09 +05:30
parent 9d737d894d
commit b4a8cb415e
2 changed files with 3 additions and 6 deletions

View File

@ -28,7 +28,7 @@ export default Ember.Controller.extend({
@computed('model.type')
showCategoryOptions(modelType) {
return !modelType.match(/_private_messages$/);
return !modelType.match(/_private_messages$/) && !modelType.match(/^page_view_/);
},
@computed('model.type')

View File

@ -66,11 +66,8 @@ class Report
ApplicationRequest.where(req_type: ApplicationRequest.req_types[filter])
end
filtered_results = data
filtered_results = data.filtered_results.where(category_id: report.category_id) if report.category_id
report.data = []
filtered_results.where('date >= ? AND date <= ?', report.start_date.to_date, report.end_date.to_date)
data.where('date >= ? AND date <= ?', report.start_date.to_date, report.end_date.to_date)
.order(date: :asc)
.group(:date)
.sum(:count)
@ -79,7 +76,7 @@ class Report
end
report.total = data.sum(:count)
report.prev30Days = filtered_results.where('date >= ? AND date <= ?',
report.prev30Days = data.where('date >= ? AND date <= ?',
(report.start_date - 31.days).to_date,
(report.end_date - 31.days).to_date )
.sum(:count)