diff --git a/arkindex/documents/serializers/elements.py b/arkindex/documents/serializers/elements.py index 7d6a9da67bb00a3540eb95512fc690a0fd6301e4..4c86b979b547ad389a176cb2726a3ab3156ea70a 100644 --- a/arkindex/documents/serializers/elements.py +++ b/arkindex/documents/serializers/elements.py @@ -231,8 +231,20 @@ class ElementSerializer(ElementSlimSerializer): class Meta: model = Element - fields = ElementSlimSerializer.Meta.fields + ('metadata', 'classifications', 'image', 'polygon', 'source') - read_only_fields = ElementSlimSerializer.Meta.read_only_fields + ('metadata', 'classifications', 'source') + fields = ElementSlimSerializer.Meta.fields + ( + 'metadata', + 'classifications', + 'image', + 'polygon', + 'source', + 'worker_version' + ) + read_only_fields = ElementSlimSerializer.Meta.read_only_fields + ( + 'metadata', + 'classifications', + 'source', + 'worker_version' + ) def create(self, *args, **kwargs): instance = super().create(*args, **kwargs) diff --git a/arkindex/documents/serializers/ml.py b/arkindex/documents/serializers/ml.py index 8a139a3e79b4b7f0f73a04b5da80db0ec1e1f341..0aff55e168409d7e62446a9e102521a5d5bfc5e7 100644 --- a/arkindex/documents/serializers/ml.py +++ b/arkindex/documents/serializers/ml.py @@ -90,7 +90,8 @@ class ClassificationSerializer(serializers.ModelSerializer): 'ml_class', 'state', 'confidence', - 'high_confidence' + 'high_confidence', + 'worker_version' ) diff --git a/arkindex/documents/tests/test_create_elements.py b/arkindex/documents/tests/test_create_elements.py index cfda5a232c82556132cef790ab6cd4b8d4a3602a..a92ae208a9ee85a1c550c656fabca014fcbfedea 100644 --- a/arkindex/documents/tests/test_create_elements.py +++ b/arkindex/documents/tests/test_create_elements.py @@ -69,6 +69,7 @@ class TestCreateElements(FixtureAPITestCase): 'thumbnail_put_url': None, 'thumbnail_url': volume.thumbnail.s3_url, 'source': None, + 'worker_version': None, 'classifications': [], 'metadata': [], 'corpus': { @@ -107,6 +108,7 @@ class TestCreateElements(FixtureAPITestCase): 'thumbnail_put_url': None, 'thumbnail_url': None, 'source': None, + 'worker_version': None, 'classifications': [], 'metadata': [], 'corpus': { @@ -246,6 +248,7 @@ class TestCreateElements(FixtureAPITestCase): 'thumbnail_put_url': None, 'thumbnail_url': None, 'source': None, + 'worker_version': None, 'classifications': [], 'metadata': [], 'corpus': { diff --git a/arkindex/documents/tests/test_moderation.py b/arkindex/documents/tests/test_moderation.py index b9f397784313fc010a7c125ed0aa36ee01e071d1..33c3825bc883b6f02a1cab813e0ab489cb48f96e 100644 --- a/arkindex/documents/tests/test_moderation.py +++ b/arkindex/documents/tests/test_moderation.py @@ -277,7 +277,8 @@ class TestClasses(FixtureAPITestCase): }, 'state': ClassificationState.Validated.value, 'confidence': classification.confidence, - 'high_confidence': False + 'high_confidence': False, + 'worker_version': None }) # Ensure moderator has been set @@ -310,7 +311,8 @@ class TestClasses(FixtureAPITestCase): }, 'state': ClassificationState.Rejected.value, 'confidence': classification.confidence, - 'high_confidence': False + 'high_confidence': False, + 'worker_version': None }) # Ensure moderator has been set @@ -361,7 +363,8 @@ class TestClasses(FixtureAPITestCase): }, 'state': ClassificationState.Rejected.value, 'confidence': classification.confidence, - 'high_confidence': False + 'high_confidence': False, + 'worker_version': None }) # Then try to validate @@ -383,7 +386,8 @@ class TestClasses(FixtureAPITestCase): }, 'state': ClassificationState.Validated.value, 'confidence': classification.confidence, - 'high_confidence': False + 'high_confidence': False, + 'worker_version': None }) def test_classification_selection_requires_login(self):