Commit f7f325c5b10d2eebba6d43c94b59375e9fcf51fa
1 parent
c1ad98a8
Exists in
master
and in
5 other branches
correction_siorg_instition_creation: Creating a Community for each institution
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
1 changed file
with
8 additions
and
0 deletions
Show diff stats
lib/institution_helper.rb
... | ... | @@ -59,6 +59,14 @@ module InstitutionHelper |
59 | 59 | end |
60 | 60 | |
61 | 61 | def self.set_institution_data institution, unit |
62 | + | |
63 | + community = if Community.where(:name=>unit["nome"]).length != 0 | |
64 | + Community.where(:name=>unit["nome"]).first | |
65 | + else | |
66 | + Community.new :name=>unit["nome"] | |
67 | + end | |
68 | + | |
69 | + institution.community = community | |
62 | 70 | institution.name = unit["nome"] |
63 | 71 | institution.acronym = unit["sigla"] |
64 | 72 | institution.unit_code = self.retrieve_code(unit,"codigoUnidade") | ... | ... |