Skip to content
Snippets Groups Projects
Commit bfd554df authored by Nico Vermaas's avatar Nico Vermaas
Browse files

reset activity on DEFINED status

parent ca84843a
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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()
......
......@@ -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' %}
......
......@@ -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):
......
......@@ -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):
"""
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment