diff --git a/backend/layers/business/business.py b/backend/layers/business/business.py index 0cae1fa31fce9..123de4ec2bc04 100644 --- a/backend/layers/business/business.py +++ b/backend/layers/business/business.py @@ -161,6 +161,11 @@ def trigger_dataset_artifact_update( new_dataset_version_id = self.create_empty_dataset_version_for_current_dataset( collection_version.version_id, current_dataset_version_id ).version_id + # Update citation for new dataset version + doi = next((link.uri for link in collection_version.metadata.links if link.type == "DOI"), None) + metadata_update.citation = self.generate_dataset_citation( + collection_version.collection_id, new_dataset_version_id, doi + ) self.batch_job_provider.start_metadata_update_batch_job( current_dataset_version_id, new_dataset_version_id, metadata_update diff --git a/tests/unit/backend/layers/business/test_business.py b/tests/unit/backend/layers/business/test_business.py index 79173797bc5a7..283d9de69a237 100644 --- a/tests/unit/backend/layers/business/test_business.py +++ b/tests/unit/backend/layers/business/test_business.py @@ -3077,7 +3077,10 @@ def test_trigger_dataset_artifact_update(self): current_dataset_version_id = revision.datasets[0].version_id self.batch_job_provider.start_metadata_update_batch_job = Mock() self.business_logic.trigger_dataset_artifact_update(revision, metadata_update, current_dataset_version_id) + self.batch_job_provider.start_metadata_update_batch_job.assert_called_once() + # Confirm citation is updated if new dataset version is generated as part of trigger_dataset_artifact_update + self.assertIsNotNone(metadata_update.citation) def test_trigger_dataset_artifact_update__with_new_dataset_version_id(self): metadata_update = DatasetArtifactMetadataUpdate(schema_version="4.0.0")