diff --git a/atdb/taskdatabase/models.py b/atdb/taskdatabase/models.py index 46809a3f7953dbc70354aaa105a8bb8681e2d2a1..0f39ebc7ac6ef92d5109ae8073a93c294b474b30 100644 --- a/atdb/taskdatabase/models.py +++ b/atdb/taskdatabase/models.py @@ -226,8 +226,14 @@ class Task(models.Model): tasks_for_this_sasid = Task.objects.filter(sas_id=self.sas_id) self.calculated_qualities = qualities.calculate_qualities(self, tasks_for_this_sasid, quality_thresholds) - # when a task goes to PROCESSED... + # when tasks are put back on defined (resetting the flow), also reset some activity values + if (self.status != State.DEFINED.value) & (self.new_status == State.DEFINED.value): + self.activity.status = State.DEFINED.value + self.activity.is_processed = False + self.activity.is_aggregated = False + self.activity.save() + # when a task goes to PROCESSED... if (self.status != State.PROCESSED.value) & (self.new_status == State.PROCESSED.value): try: # ...but only when the tasks of this activity are not yet aggregated @@ -239,9 +245,7 @@ class Task(models.Model): # if so, temporarily put it on hold so that the ancillary service can grab it with it if self.is_summary: - #TODO: uncomment to enable aggregator - #self.resume = False - pass + self.resume = False except Exception as error: # this should never happen diff --git a/atdb/taskdatabase/services/activities_handler.py b/atdb/taskdatabase/services/activities_handler.py index 68b1666bb6b1a171878b441bfd36a04a4697dd73..a5f20e10fa679c5fdcac7b77bf0224a65071cd6f 100644 --- a/atdb/taskdatabase/services/activities_handler.py +++ b/atdb/taskdatabase/services/activities_handler.py @@ -151,9 +151,7 @@ def update_activity(task): if activity.is_processed != current_is_processed: # if the whole activity has become processed, then set the status of this activity to 'AGGREGATE' if (activity.is_processed & non_discarded_found): - # TODO: uncomment to enable aggregator - # activity.status = State.AGGREGATE.value - pass + activity.status = State.AGGREGATE.value activity.save() diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index 35df7c2ab88f7b2c6d3d17f6a154226f7173dbe3..303d0b496f3e4068f5482b027bae84660b130c6d 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -31,7 +31,7 @@ {% include 'taskdatabase/pagination.html' %} </div> </div> - <p class="footer"> Version 19 Apr 2024 (a) + <p class="footer"> Version 19 Apr 2024 </div> {% include 'taskdatabase/refresh.html' %} diff --git a/atdb/taskdatabase/tests/test_models_processed_summary.py b/atdb/taskdatabase/tests/test_models_processed_summary.py index 3b996d524a57a6f7ed8e945eff0b75931e3c559e..81f6abe6309cec2b60e4a614748f393c9310672b 100644 --- a/atdb/taskdatabase/tests/test_models_processed_summary.py +++ b/atdb/taskdatabase/tests/test_models_processed_summary.py @@ -32,15 +32,15 @@ class TestProcessedSummary(TestCase): actual = self.task1.resume self.assertEqual(actual, True) - # TODO: uncomment to enable aggregator - # def test_processed_on_hold(self): - # """ - # task 2 is processed, and a summary dataproduct. Should go on hold - # """ - # - # actual = self.task2.resume - # # this test fails, because "self.resume = False" is still commented out in models.py L249 - # self.assertEqual(actual, False) + + def test_processed_on_hold(self): + """ + task 2 is processed, and a summary dataproduct. Should go on hold + """ + + actual = self.task2.resume + # this test fails, because "self.resume = False" is still commented out in models.py L249 + self.assertEqual(actual, False) def test_activity_is_processed(self): diff --git a/atdb/taskdatabase/tests/test_summary_tasks.py b/atdb/taskdatabase/tests/test_summary_tasks.py index 667f837a66b2b65f0f13aec05ea0e059ee0ed6b7..e607fd0cdb27f62b130014c53e8e245e2e5eb47e 100644 --- a/atdb/taskdatabase/tests/test_summary_tasks.py +++ b/atdb/taskdatabase/tests/test_summary_tasks.py @@ -51,13 +51,12 @@ class TestSummaryTasks(TestCase): self.summary_task_processed_77777.save() self.assertTrue(self.summary_task_processed_77777.is_summary) - # TODO: uncomment to enable aggregator - # def test_summary_task_processed_goes_on_hold(self): - # """ - # test summary task, at 'stored' it should know that it is a summary task and return True) - # """ - # self.summary_task_processed_88888.save() - # self.assertFalse(self.summary_task_processed_88888.resume) + def test_summary_task_processed_goes_on_hold(self): + """ + test summary task, at 'stored' it should know that it is a summary task and return True) + """ + self.summary_task_processed_88888.save() + self.assertFalse(self.summary_task_processed_88888.resume) def test_activity_77777_not_is_processed(self): """ diff --git a/atdb/taskdatabase/tests/test_update_activity.py b/atdb/taskdatabase/tests/test_update_activity.py index 35501e48afc23c9b7aec77d6a8478abbf1c19a18..5629c8f8e23181f8fb018cc9b57979a94b7ff897 100644 --- a/atdb/taskdatabase/tests/test_update_activity.py +++ b/atdb/taskdatabase/tests/test_update_activity.py @@ -185,17 +185,17 @@ class TestUpdateActivity(TestCase): actual = activity.is_processed self.assertEqual(actual, False) - # TODO: uncomment to enable aggregator - # def test_is_processed(self): - # """ - # task 6, 7 and 8 are processed, - # activity.is_processed should be true and activity status should go to 'aggregate' - # """ - # - # activity = self.task6.activity - # - # actual = activity.is_processed - # self.assertEqual(actual, True) - # - # actual = activity.status - # self.assertEqual(actual, State.AGGREGATE.value) \ No newline at end of file + + def test_is_processed(self): + """ + task 6, 7 and 8 are processed, + activity.is_processed should be true and activity status should go to 'aggregate' + """ + + activity = self.task6.activity + + actual = activity.is_processed + self.assertEqual(actual, True) + + actual = activity.status + self.assertEqual(actual, State.AGGREGATE.value) \ No newline at end of file