Skip to content

Commit

Permalink
Modifica a atribuição de afiliação
Browse files Browse the repository at this point in the history
A atribuição é removida de load_article e inserida em
get_one_contributor
  • Loading branch information
Rossi-Luciano committed Jul 21, 2022
1 parent 79926f1 commit 7be2ba3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions scholarly_articles/scripts/load_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ def load_article(row):
article.save()
for author in row['z_authors']:
contributor = get_one_contributor(author)
if author.get('affiliation'):
try:
aff = load_affiliation(author['affiliation'][0]['name'])
contributor.affiliation = aff
contributor.save()
except KeyError:
pass
article.contributors.add(contributor)
article.save()
return article
Expand Down Expand Up @@ -72,6 +65,12 @@ def get_one_contributor(author):
contributor.given = author.get('given')
contributor.orcid = author.get('ORCID')
contributor.authenticated_orcid = author.get('authenticated-orcid')
if author.get('affiliation'):
try:
aff = load_affiliation(author['affiliation'][0]['name'])
contributor.affiliation = aff
except KeyError:
pass
contributor.save()
return contributor

Expand Down

0 comments on commit 7be2ba3

Please sign in to comment.