Skip to content

Commit

Permalink
AR-1484 make agent description an array if there are more than one note
Browse files Browse the repository at this point in the history
  • Loading branch information
jambun authored and marktriggs committed Jun 19, 2017
1 parent b8480ed commit 0484bdc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
7 changes: 3 additions & 4 deletions public-new/app/models/agent_corporate_entity.rb
Expand Up @@ -15,11 +15,10 @@ def metadata
md['dissolutionDate'] = dates['end'] if dates['end']
end

md['description'] = if (note = json['notes'].select{|n| n['jsonmodel_type'] == 'note_bioghist'}.first)
md['description'] = json['notes'].select{|n| n['jsonmodel_type'] == 'note_bioghist'}.map{|note|
strip_mixed_content(note['subnotes'].map{|s| s['content']}.join(' '))
else
''
end
}
md['description'] = md['description'][0] if md['description'].length == 1

md
end
Expand Down
7 changes: 3 additions & 4 deletions public-new/app/models/agent_family.rb
Expand Up @@ -15,11 +15,10 @@ def metadata
md['dissolutionDate'] = dates['end'] if dates['end']
end

md['description'] = if (note = json['notes'].select{|n| n['jsonmodel_type'] == 'note_bioghist'}.first)
md['description'] = json['notes'].select{|n| n['jsonmodel_type'] == 'note_bioghist'}.map{|note|
strip_mixed_content(note['subnotes'].map{|s| s['content']}.join(' '))
else
''
end
}
md['description'] = md['description'][0] if md['description'].length == 1

md
end
Expand Down
7 changes: 3 additions & 4 deletions public-new/app/models/agent_person.rb
Expand Up @@ -15,11 +15,10 @@ def metadata
md['deathDate'] = dates['end'] if dates['end']
end

md['description'] = if (note = json['notes'].select{|n| n['jsonmodel_type'] == 'note_bioghist'}.first)
md['description'] = json['notes'].select{|n| n['jsonmodel_type'] == 'note_bioghist'}.map{|note|
strip_mixed_content(note['subnotes'].map{|s| s['content']}.join(' '))
else
''
end
}
md['description'] = md['description'][0] if md['description'].length == 1

md['knows'] = json['related_agents'].select{|ra|
ra['relator'] == ra['is_associative_with'] && ra['_resolved']['jsonmodel_type'] == json['jsonmodel_type']}.map do |ag|
Expand Down

0 comments on commit 0484bdc

Please sign in to comment.