feat: Add language filter for parent analysis

mciea-main
rebuilt 8 months ago
parent 8e5e2a030a
commit 1845d1ac7b

@ -110,10 +110,11 @@ class SurveyResponsesDataLoader
end end
if row.respondent_type == :parent if row.respondent_type == :parent
unknown_housing = Housing.find_by(designation: row.housing).id parent = Parent.find_or_create_by(response_id: row.response_id)
parent = Parent.find_or_create_by(response_id: row.response_id, housing_id: unknown_housing)
parent.number_of_children = row.number_of_children parent.number_of_children = row.number_of_children
tmp_languages = row.languages.map { |language| languages[language] } tmp_languages = row.languages.map { |language| languages[language] }
parent.housing_id = Housing.find_by(designation: row.housing).id
parent.languages.delete_all
parent.languages.concat(tmp_languages) parent.languages.concat(tmp_languages)
parent.housing = Housing.find_by(designation: row.housing) parent.housing = Housing.find_by(designation: row.housing)
parent.save parent.save

Loading…
Cancel
Save