Skip to content

Commit

Permalink
Add instance check for metadata_submission
Browse files Browse the repository at this point in the history
  • Loading branch information
James Tessmer committed Oct 9, 2024
1 parent f623939 commit 43e0549
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ def upgrade():
mappings = []
for submission_metadata in session.query(SubmissionMetadata):
metadata_submission = submission_metadata.metadata_submission

if isinstance(metadata_submission, list):
continue

context_form = metadata_submission["contextForm"]


if not context_form.get("awardDoi", None) and context_form.get("datasetDoi", None):
holder = context_form["datasetDoi"]
holder = holder.split(",")
Expand All @@ -57,6 +62,10 @@ def downgrade():
mappings = []
for submission_metadata in session.query(SubmissionMetadata):
metadata_submission = submission_metadata.metadata_submission

if isinstance(metadata_submission, list):
continue

context_form = metadata_submission["contextForm"]

if not context_form.get("datasetDoi", None) and context_form.get("awardDoi", None):
Expand Down

0 comments on commit 43e0549

Please sign in to comment.