Loading trapper/trapper-project/trapper/apps/accounts/tests/test_rest_views.py +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ from rest_framework.test import APITestCase from trapper.apps.accounts.models import User from trapper.apps.common.tests.commons import BaseAPITestCase from trapper.apps.media_classification.models import ClassificationProject from trapper.apps.storage.tests.factories.classification_project import ( from trapper.apps.media_classification.tests.factories.classification_project import ( ClassificationProjectFactory, ) Loading trapper/trapper-project/trapper/apps/citizen_science/tasks.py +16 −0 Original line number Diff line number Diff line Loading @@ -29,9 +29,15 @@ def celery_check_if_cs_collection_finished( try: collection = Collection.objects.get(pk=collection_pk, owner=user_pk) except Collection.DoesNotExist: logger.warning( f"Collection with pk {collection_pk} not found for user {user_pk}." ) return # If collection is already finished do nothing if collection.is_complete_cs_collection: logger.info( f"Collection {collection_pk} for user {user_pk} is already complete." ) return # if collection is not finished check date between last uploaded resource # and collection Loading Loading @@ -72,6 +78,9 @@ def complete_collection_upload( try: collection = Collection.objects.get(pk=collection_pk) except Collection.DoesNotExist: logger.warning( f"Collection with pk {collection_pk} not found for user {user_pk}." ) return collection.is_complete_cs_collection = True collection.date_complete_cs_collection_upload = timezone.now() Loading @@ -85,9 +94,16 @@ def complete_collection_upload( # Collect arguments for sequence building and AI pipeline tasks conf = CitizenScienceConfiguration.get_solo() user = User.objects.get(pk=user_pk) try: project_collection = ClassificationProjectCollection.objects.get( project_id=classification_project_pk, collection__collection=collection ) except ClassificationProjectCollection.DoesNotExist: logger.warning( f"ClassificationProjectCollection with project {classification_project_pk} " f"and collection {collection_pk} not found." ) return # Run sequence builder task = celery_build_sequences.delay( Loading trapper/trapper-project/trapper/apps/citizen_science/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ from trapper.apps.storage.taxonomy import ( ResourceStatus, ResourceMetadataTags, ) from trapper.apps.storage.tests.factories.classification_project import ( from trapper.apps.media_classification.tests.factories.classification_project import ( ClassificationProjectFactory, ) from trapper.apps.storage.tests.factories.collection import CollectionFactory Loading trapper/trapper-project/trapper/apps/common/utils/test_tools.py +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ from trapper.apps.research.models import ( from trapper.apps.research.taxonomy import ResearchProjectStatus from trapper.apps.storage.models import Resource, Collection, CollectionMember from trapper.apps.storage.taxonomy import ResourceStatus, CollectionStatus from trapper.apps.storage.tests.factories.classification_project import ( from trapper.apps.media_classification.tests.factories.classification_project import ( ClassificationProjectFactory, ) Loading trapper/trapper-project/trapper/apps/geomap/tests/test_deployments.py +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ from trapper.apps.research.tests.factories.research_project import ( ) from trapper.apps.storage.models import Resource, Collection from trapper.apps.storage.taxonomy import CollectionStatus, ResourceStatus from trapper.apps.storage.tests.factories.classification_project import ( from trapper.apps.media_classification.tests.factories.classification_project import ( ClassificationProjectFactory, ) from trapper.apps.storage.tests.factories.collection import CollectionFactory Loading Loading
trapper/trapper-project/trapper/apps/accounts/tests/test_rest_views.py +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ from rest_framework.test import APITestCase from trapper.apps.accounts.models import User from trapper.apps.common.tests.commons import BaseAPITestCase from trapper.apps.media_classification.models import ClassificationProject from trapper.apps.storage.tests.factories.classification_project import ( from trapper.apps.media_classification.tests.factories.classification_project import ( ClassificationProjectFactory, ) Loading
trapper/trapper-project/trapper/apps/citizen_science/tasks.py +16 −0 Original line number Diff line number Diff line Loading @@ -29,9 +29,15 @@ def celery_check_if_cs_collection_finished( try: collection = Collection.objects.get(pk=collection_pk, owner=user_pk) except Collection.DoesNotExist: logger.warning( f"Collection with pk {collection_pk} not found for user {user_pk}." ) return # If collection is already finished do nothing if collection.is_complete_cs_collection: logger.info( f"Collection {collection_pk} for user {user_pk} is already complete." ) return # if collection is not finished check date between last uploaded resource # and collection Loading Loading @@ -72,6 +78,9 @@ def complete_collection_upload( try: collection = Collection.objects.get(pk=collection_pk) except Collection.DoesNotExist: logger.warning( f"Collection with pk {collection_pk} not found for user {user_pk}." ) return collection.is_complete_cs_collection = True collection.date_complete_cs_collection_upload = timezone.now() Loading @@ -85,9 +94,16 @@ def complete_collection_upload( # Collect arguments for sequence building and AI pipeline tasks conf = CitizenScienceConfiguration.get_solo() user = User.objects.get(pk=user_pk) try: project_collection = ClassificationProjectCollection.objects.get( project_id=classification_project_pk, collection__collection=collection ) except ClassificationProjectCollection.DoesNotExist: logger.warning( f"ClassificationProjectCollection with project {classification_project_pk} " f"and collection {collection_pk} not found." ) return # Run sequence builder task = celery_build_sequences.delay( Loading
trapper/trapper-project/trapper/apps/citizen_science/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ from trapper.apps.storage.taxonomy import ( ResourceStatus, ResourceMetadataTags, ) from trapper.apps.storage.tests.factories.classification_project import ( from trapper.apps.media_classification.tests.factories.classification_project import ( ClassificationProjectFactory, ) from trapper.apps.storage.tests.factories.collection import CollectionFactory Loading
trapper/trapper-project/trapper/apps/common/utils/test_tools.py +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ from trapper.apps.research.models import ( from trapper.apps.research.taxonomy import ResearchProjectStatus from trapper.apps.storage.models import Resource, Collection, CollectionMember from trapper.apps.storage.taxonomy import ResourceStatus, CollectionStatus from trapper.apps.storage.tests.factories.classification_project import ( from trapper.apps.media_classification.tests.factories.classification_project import ( ClassificationProjectFactory, ) Loading
trapper/trapper-project/trapper/apps/geomap/tests/test_deployments.py +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ from trapper.apps.research.tests.factories.research_project import ( ) from trapper.apps.storage.models import Resource, Collection from trapper.apps.storage.taxonomy import CollectionStatus, ResourceStatus from trapper.apps.storage.tests.factories.classification_project import ( from trapper.apps.media_classification.tests.factories.classification_project import ( ClassificationProjectFactory, ) from trapper.apps.storage.tests.factories.collection import CollectionFactory Loading