Skip to content

Commit 7e7f928

Browse files
committed
fix comment
1 parent 3e13e89 commit 7e7f928

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

osf/models/collection_submission.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ def sync_cedar_metadata(self):
488488
return
489489
template = self.collection.provider.required_metadata_template
490490
metadata = {f: getattr(self, f) for f in CEDAR_METADATA_FIELDS if getattr(self, f, '')}
491+
metadata['@context'] = template.cedar_id
491492
record, _ = CedarMetadataRecord.objects.get_or_create(guid=self.guid, template=template)
492493
record.metadata = metadata
493494
record.is_published = True

osf_tests/management_commands/test_copy_collection_submission_metadata_to_cedar.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_record_contains_non_empty_fields_only(self, provider_with_template, ced
8787
copy_collection_submission_metadata_to_cedar()
8888

8989
record = CedarMetadataRecord.objects.get(guid=submission.guid, template=cedar_template)
90-
assert record.metadata == {'collected_type': 'dataset'}
90+
assert record.metadata == {'collected_type': 'dataset', '@context': cedar_template.cedar_id}
9191

9292
def test_record_is_published(self, provider_with_template, cedar_template):
9393
collection = make_collection(provider_with_template)
@@ -111,7 +111,7 @@ def test_updates_existing_record(self, provider_with_template, cedar_template):
111111
copy_collection_submission_metadata_to_cedar()
112112

113113
record = CedarMetadataRecord.objects.get(guid=submission.guid, template=cedar_template)
114-
assert record.metadata == {'status': 'new'}
114+
assert record.metadata == {'status': 'new', '@context': cedar_template.cedar_id}
115115
assert record.is_published is True
116116

117117
def test_skips_submissions_without_required_template(self, provider_without_template):
@@ -217,4 +217,5 @@ def test_all_cedar_fields_copied(self, provider_with_template, cedar_template):
217217
'data_type': 'quantitative',
218218
'disease': 'cancer',
219219
'grade_levels': 'K-12',
220+
'@context': cedar_template.cedar_id,
220221
}

0 commit comments

Comments
 (0)