mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 13:38:18 -08:00
chore: add includes call to ensure we don't do an n+1 query
This commit is contained in:
parent
138c61e7f0
commit
4331c01789
1 changed files with 5 additions and 5 deletions
|
|
@ -1,12 +1,12 @@
|
|||
class SocioEconomicCalculator
|
||||
def self.update_socio_economic_scores
|
||||
parent_list = [].tap do |list|
|
||||
Parent.all.each do |parent|
|
||||
Parent.includes(:employments, :benefit, :education).all.each do |parent|
|
||||
parent.socio_economic_status = if has_all_socio_economic_data?(parent:)
|
||||
socio_economic_score(parent.education, parent.benefit, parent.employments)
|
||||
else
|
||||
-1
|
||||
end
|
||||
socio_economic_score(parent.education, parent.benefit, parent.employments)
|
||||
else
|
||||
-1
|
||||
end
|
||||
|
||||
list << parent
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue