mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Optimize School lookup by qualtrics code query
This commit is contained in:
parent
c66134e25e
commit
fd55c7c82a
2 changed files with 3 additions and 2 deletions
|
|
@ -15,7 +15,8 @@ class School < ApplicationRecord
|
|||
|
||||
def self.find_by_district_code_and_school_code(district_code, school_code)
|
||||
School
|
||||
.where(district: District.find_by_qualtrics_code(district_code))
|
||||
.joins(:district)
|
||||
.where(districts: {qualtrics_code: district_code})
|
||||
.find_by_qualtrics_code(school_code)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class SurveyResponsesDataLoader
|
|||
return if school.nil?
|
||||
|
||||
survey_items.each do |survey_item|
|
||||
return unless SurveyItemResponse.where(response_id: response_id, survey_item: survey_item).empty?
|
||||
return unless SurveyItemResponse.find_by(response_id: response_id, survey_item: survey_item).nil?
|
||||
|
||||
likert_score = row[survey_item.survey_item_id]
|
||||
next if likert_score.nil?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue