From b6675c25161fbcad586fe8e3143a247a4be37df6 Mon Sep 17 00:00:00 2001 From: rebuilt Date: Thu, 30 Oct 2025 13:32:39 -0700 Subject: [PATCH] ECP-206 Delete the 3 info boxes for each sub-category on the Browse page --- Gemfile | 1 + Gemfile.lock | 15 +++++--- app/helpers/analyze_helper.rb | 2 +- app/models/benefit.rb | 2 +- app/models/education.rb | 2 +- app/models/employment.rb | 2 +- app/presenters/analyze/graph/column/ell.rb | 2 +- app/presenters/analyze/graph/column/gender.rb | 2 +- app/presenters/analyze/graph/column/grade.rb | 2 +- app/presenters/analyze/graph/column/sped.rb | 2 +- app/services/survey_responses_data_loader.rb | 2 +- .../categories/_subcategory_section.html.erb | 26 -------------- lib/tasks/upload.rake | 4 +-- spec/services/survey_item_values_spec.rb | 34 +++++++++---------- .../survey_responses_data_loader_spec.rb | 8 ++--- 15 files changed, 43 insertions(+), 63 deletions(-) diff --git a/Gemfile b/Gemfile index 1366de09..2de59690 100644 --- a/Gemfile +++ b/Gemfile @@ -54,6 +54,7 @@ group :development do gem 'rubocop-rspec', require: false gem 'rubocop-rspec_rails' gem 'seed_dump' + gem 'solargraph' gem 'solargraph-reek' gem 'spring' # gem "web-console" diff --git a/Gemfile.lock b/Gemfile.lock index 53c53115..dde1e483 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -386,7 +386,7 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rbs (3.9.4) + rbs (3.9.5) logger rdoc (6.14.0) erb @@ -481,7 +481,7 @@ GEM simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) smart_properties (1.17.0) - solargraph (0.55.1) + solargraph (0.57.0) backport (~> 1.2) benchmark (~> 0.4) bundler (~> 2.0) @@ -493,12 +493,14 @@ GEM observer (~> 0.1) ostruct (~> 0.6) parser (~> 3.0) - rbs (~> 3.3) + prism (~> 1.4) + rbs (>= 3.6.1, <= 4.0.0.dev.4) reverse_markdown (~> 3.0) - rubocop (~> 1.38) + rubocop (~> 1.76) thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) + yard-activesupport-concern (~> 0.0) yard-solargraph (~> 0.1) solargraph-reek (0.1.1) reek (>= 5.0) @@ -517,7 +519,7 @@ GEM railties (>= 6.0.0) stringio (3.1.7) thor (1.3.2) - tilt (2.6.0) + tilt (2.6.1) timeout (0.4.3) trollop (2.9.10) turbo-rails (2.0.16) @@ -545,6 +547,8 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.37) + yard-activesupport-concern (0.0.1) + yard (>= 0.8) yard-solargraph (0.1.0) yard (~> 0.9) zeitwerk (2.7.3) @@ -607,6 +611,7 @@ DEPENDENCIES rubocop-rspec_rails seed_dump simplecov + solargraph solargraph-reek spring sprockets-rails diff --git a/app/helpers/analyze_helper.rb b/app/helpers/analyze_helper.rb index 47bcf15a..826528dc 100644 --- a/app/helpers/analyze_helper.rb +++ b/app/helpers/analyze_helper.rb @@ -69,6 +69,6 @@ module AnalyzeHelper def base_url analyze_subcategory_link(district: @district, school: @school, academic_year: @academic_year, category: @presenter.category, - subcategory: @presenter.subcategory) + subcategory: @presenter.subcategory) end end diff --git a/app/models/benefit.rb b/app/models/benefit.rb index 5055e7ba..6cdcc183 100644 --- a/app/models/benefit.rb +++ b/app/models/benefit.rb @@ -2,7 +2,7 @@ class Benefit < ApplicationRecord scope :by_designation, -> { all.map { |benefits| [benefits.designation, benefits] }.to_h } def self.to_designation(benefits) - return "Unknown" if benefits.blank? or benefits.nil? + return "Unknown" if benefits.blank? || benefits.nil? case benefits in /^1$/i diff --git a/app/models/education.rb b/app/models/education.rb index e4275686..0f62d76f 100644 --- a/app/models/education.rb +++ b/app/models/education.rb @@ -2,7 +2,7 @@ class Education < ApplicationRecord scope :by_designation, -> { all.map { |education| [education.designation, education] }.to_h } def self.to_designation(education) - return "Unknown" if education.blank? or education.nil? + return "Unknown" if education.blank? || education.nil? case education in /^1$/i diff --git a/app/models/employment.rb b/app/models/employment.rb index fb05a3f0..45687477 100644 --- a/app/models/employment.rb +++ b/app/models/employment.rb @@ -2,7 +2,7 @@ class Employment < ApplicationRecord scope :by_designation, -> { all.map { |employment| [employment.designation, employment] }.to_h } def self.to_designation(employment) - return "Unknown" if employment.blank? or employment.nil? + return "Unknown" if employment.blank? || employment.nil? case employment in /^1$|^1100$/i diff --git a/app/presenters/analyze/graph/column/ell.rb b/app/presenters/analyze/graph/column/ell.rb index 22de434f..9c4d42a1 100644 --- a/app/presenters/analyze/graph/column/ell.rb +++ b/app/presenters/analyze/graph/column/ell.rb @@ -11,7 +11,7 @@ module Analyze end def label - ["#{ell.designation}"] + [ell.designation.to_s] end def basis diff --git a/app/presenters/analyze/graph/column/gender.rb b/app/presenters/analyze/graph/column/gender.rb index 57b0673b..1d2eff4b 100644 --- a/app/presenters/analyze/graph/column/gender.rb +++ b/app/presenters/analyze/graph/column/gender.rb @@ -11,7 +11,7 @@ module Analyze end def label - ["#{gender.designation}"] + [gender.designation.to_s] end def basis diff --git a/app/presenters/analyze/graph/column/grade.rb b/app/presenters/analyze/graph/column/grade.rb index ccabd6a9..6055027a 100644 --- a/app/presenters/analyze/graph/column/grade.rb +++ b/app/presenters/analyze/graph/column/grade.rb @@ -11,7 +11,7 @@ module Analyze end def label - ["#{grade}"] + [grade.to_s] end def basis diff --git a/app/presenters/analyze/graph/column/sped.rb b/app/presenters/analyze/graph/column/sped.rb index 32b47eab..a28ca15a 100644 --- a/app/presenters/analyze/graph/column/sped.rb +++ b/app/presenters/analyze/graph/column/sped.rb @@ -11,7 +11,7 @@ module Analyze end def label - ["#{sped.designation}"] + [sped.designation.to_s] end def basis diff --git a/app/services/survey_responses_data_loader.rb b/app/services/survey_responses_data_loader.rb index e54bab1e..b28b7d78 100644 --- a/app/services/survey_responses_data_loader.rb +++ b/app/services/survey_responses_data_loader.rb @@ -49,7 +49,7 @@ class SurveyResponsesDataLoader workers = pool_size.times.map do Thread.new do - while slice = jobs.pop(true) + while (slice = jobs.pop(true)) slice.each do |line| survey_item_responses = [] diff --git a/app/views/categories/_subcategory_section.html.erb b/app/views/categories/_subcategory_section.html.erb index 878441e5..e44937e2 100644 --- a/app/views/categories/_subcategory_section.html.erb +++ b/app/views/categories/_subcategory_section.html.erb @@ -13,32 +13,6 @@

<%= subcategory.description %>

-
-
-

<%= subcategory.admin_collection_rate.first %> / <%= subcategory.admin_collection_rate.last %>

-

school data sources

-
-
-

<%= subcategory.student_response_rate %>

-

of students responded

-
-
-

<%= subcategory.teacher_response_rate %>

-

of teachers responded

-
-
diff --git a/lib/tasks/upload.rake b/lib/tasks/upload.rake index 667e5c06..b592fb03 100644 --- a/lib/tasks/upload.rake +++ b/lib/tasks/upload.rake @@ -39,14 +39,14 @@ namespace :upload do upload_filename = filename.split('sqm-dashboards')[1][1..] upload_directory = upload_filename.rpartition('/').first - tmp_dir = upload_directory + '/' + tmp_dir = "#{upload_directory}/" parent_dir = "/" while tmp_dir.include?('/') first_dir = tmp_dir.split('/').first sftp.mkdir!("#{parent_dir}#{first_dir}/") unless sftp.dir.entries(parent_dir).map(&:name).include?(first_dir) - parent_dir += first_dir + '/' + parent_dir += "#{first_dir}/" tmp_dir = tmp_dir.split('/')[1..].join('/') end sftp.mkdir!("#{parent_dir}#{tmp_dir}/") unless sftp.dir.entries(parent_dir).map(&:name).include?(first_dir) diff --git a/spec/services/survey_item_values_spec.rb b/spec/services/survey_item_values_spec.rb index 44fd5abc..753d508a 100644 --- a/spec/services/survey_item_values_spec.rb +++ b/spec/services/survey_item_values_spec.rb @@ -462,7 +462,7 @@ RSpec.describe SurveyItemValues, type: :model do it "returns an unknown race" do row = {"Race-1" => ""} - row.keys.each do |key| + row.each_key do |key| headers << key end @@ -475,7 +475,7 @@ RSpec.describe SurveyItemValues, type: :model do it "returns an unknown race" do row = {"Race-1" => "99", "Race-2" => "99", "Race-3" => "", "Race-4" => "nil"} - row.keys.each do |key| + row.each_key do |key| headers << key end @@ -488,15 +488,15 @@ RSpec.describe SurveyItemValues, type: :model do context "for defined races" do it "returns the qualtrics code of that race" do - [1,2,3,4,5,8].each do |i| - row = {"Race-1" => "#{i}"} + [1, 2, 3, 4, 5, 8].each do |i| + row = {"Race-1" => i.to_s} - row.keys.each do |key| - headers << key - end + row.each_key do |key| + headers << key + end - values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:) - expect(values.races_of_children).to eq [i] + values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:) + expect(values.races_of_children).to eq [i] end end end @@ -506,7 +506,7 @@ RSpec.describe SurveyItemValues, type: :model do row = {"Race-1" => "6"} - row.keys.each do |key| + row.each_key do |key| headers << key end @@ -515,7 +515,7 @@ RSpec.describe SurveyItemValues, type: :model do row = {"Race-1" => "7"} - row.keys.each do |key| + row.each_key do |key| headers << key end @@ -530,14 +530,14 @@ RSpec.describe SurveyItemValues, type: :model do context "when there is more than one race defined" do it "returns the qualtrics code for the two races and the designation for multiracial(100)" do - row = {"Race-1" => "1", "Race-2" => "2","Race-3" => "3"} + row = {"Race-1" => "1", "Race-2" => "2", "Race-3" => "3"} - row.keys.each do |key| - headers << key - end + row.each_key do |key| + headers << key + end - values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:) - expect(values.races_of_children).to eq [1,2,3,100] + values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:) + expect(values.races_of_children).to eq [1, 2, 3, 100] end end diff --git a/spec/services/survey_responses_data_loader_spec.rb b/spec/services/survey_responses_data_loader_spec.rb index 3d6da850..b22e3605 100644 --- a/spec/services/survey_responses_data_loader_spec.rb +++ b/spec/services/survey_responses_data_loader_spec.rb @@ -368,16 +368,16 @@ describe SurveyResponsesDataLoader do it "returns -1 when any aspect of the data is unknown" do score = SocioEconomicCalculator.socio_economic_score(Education.new(designation: "Associates Degree"), Benefit.new(designation: "Unknown"), [Employment.new(designation: "Two adults with full-time employment")]) - expect(score).to eq -1 + expect(score).to eq(-1) score = SocioEconomicCalculator.socio_economic_score(Education.new(designation: "Associates Degree"), Benefit.new(designation: "No"), [Employment.new(designation: "Unknown")]) - expect(score).to eq -1 + expect(score).to eq(-1) score = SocioEconomicCalculator.socio_economic_score(Education.new(designation: "Unknown"), Benefit.new(designation: "No"), [Employment.new(designation: "No full-time or part-time employment")]) - expect(score).to eq -1 + expect(score).to eq(-1) score = SocioEconomicCalculator.socio_economic_score(Education.new(designation: "Unknown"), Benefit.new(designation: "No"), []) - expect(score).to eq -1 + expect(score).to eq(-1) end end end