mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Improve efficiency when checking whether survey item responses already exist
- see https://semaphoreci.com/blog/2017/03/14/faster-rails-how-to-check-if-a-record-exists.html for more info if curious
This commit is contained in:
parent
f045ca76b7
commit
6477792f1d
1 changed files with 1 additions and 1 deletions
|
|
@ -38,7 +38,7 @@ class SurveyResponsesDataLoader
|
|||
return if school.nil?
|
||||
|
||||
survey_items.map do |survey_item|
|
||||
next unless SurveyItemResponse.find_by(response_id: response_id, survey_item: survey_item).nil?
|
||||
next if SurveyItemResponse.where(response_id: response_id, survey_item: survey_item).exists?
|
||||
|
||||
likert_score = row[survey_item.survey_item_id]
|
||||
next if likert_score.nil?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue