Admin reports with accounts (#2092)
* Add a ReportFilter class * Add reports and targeted_reports relationships to Account * Use ReportFilter from admin/reports controller * Link to admin/reports filtered views from admin account show view * Add indexes to reports.account_id and reports.target_account_id
This commit is contained in:
parent
f23281e31e
commit
66d8f99a30
9 changed files with 92 additions and 5 deletions
|
@ -49,14 +49,18 @@ module Admin
|
|||
end
|
||||
|
||||
def filtered_reports
|
||||
filtering_scope.order('id desc').includes(
|
||||
ReportFilter.new(filter_params).results.order('id desc').includes(
|
||||
:account,
|
||||
:target_account
|
||||
)
|
||||
end
|
||||
|
||||
def filtering_scope
|
||||
params[:resolved].present? ? Report.resolved : Report.unresolved
|
||||
def filter_params
|
||||
params.permit(
|
||||
:account_id,
|
||||
:resolved,
|
||||
:target_account_id
|
||||
)
|
||||
end
|
||||
|
||||
def set_report
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue