From c4e5705bde0ffc30bd70f22ce11e685c5a7b8ce8 Mon Sep 17 00:00:00 2001 From: Leigh Dodds Date: Fri, 24 Jan 2025 09:49:07 +0000 Subject: [PATCH] Tidy, add spec --- .../admin/prob_data_reports_controller.rb | 2 +- .../admin/prob_data_reports/index.html.erb | 24 +++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/prob_data_reports_controller.rb b/app/controllers/admin/prob_data_reports_controller.rb index 9b1c83a162..aab222cf89 100644 --- a/app/controllers/admin/prob_data_reports_controller.rb +++ b/app/controllers/admin/prob_data_reports_controller.rb @@ -12,7 +12,7 @@ def find_prob_data .joins('LEFT JOIN school_groups on schools.school_group_id = school_groups.id') .where(status: 'PROB') .group('school_groups.name', 'schools.name', 'schools.slug', 'meters.meter_type', 'meters.name', :mpan_mprn, 'meters.id') - .order('count(mpan_mprn) DESC') + .order('count(mpan_mprn) DESC, school_groups.name, schools.name') .count .map { |row| row.to_a.flatten } end diff --git a/app/views/admin/prob_data_reports/index.html.erb b/app/views/admin/prob_data_reports/index.html.erb index aebe002c07..ca280a1237 100644 --- a/app/views/admin/prob_data_reports/index.html.erb +++ b/app/views/admin/prob_data_reports/index.html.erb @@ -2,14 +2,26 @@ <%= header_nav_link 'Admin', admin_url %> <% end %> - +

+ Lists all of the meters in the system that have one or more "PROB" data readings. + These are readings where we have missing data but the analytics has been unable to + find a good substitute. +

+ +

+ The report can be used to identify meters with very poor data quality, as well as + examples of where we might improve our substitutions rules. +

+ +
- + + - + @@ -20,8 +32,10 @@ <%= link_to row[1], school_meters_path(school_id: row[2]) %> +
School group SchoolMeter name/mpan/mprnMeter nameMPXN Meter typeCount of PROB recordsCount
- <%= link_to [row[4], row[5]].reject(&:blank?).join(': '), - admin_reports_amr_validated_reading_url(meter_id: row[6]) %> + <%= row[4] %> + + <%= link_to row[5], admin_reports_amr_validated_reading_url(meter_id: row[6]) %> <%= row[3] %>