From a2f652ac6aa1a0758bacc4832a1a52445229059e Mon Sep 17 00:00:00 2001 From: jszewczulak <128841175+jszewczulak@users.noreply.github.com> Date: Tue, 17 Oct 2023 14:05:15 -0400 Subject: [PATCH] feat: updated blocked submission lookup query (batch update) (#2077) --- openassessment/__init__.py | 2 +- .../workflow/test/test_workflow_batch_update_api.py | 9 ++++++++- openassessment/workflow/workflow_batch_update_api.py | 3 ++- package.json | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/openassessment/__init__.py b/openassessment/__init__.py index 84d24f5801..625d402e2c 100644 --- a/openassessment/__init__.py +++ b/openassessment/__init__.py @@ -2,4 +2,4 @@ Initialization Information for Open Assessment Module """ -__version__ = '5.5.5' +__version__ = '5.5.6' diff --git a/openassessment/workflow/test/test_workflow_batch_update_api.py b/openassessment/workflow/test/test_workflow_batch_update_api.py index 7444fd751b..fb9f75e9cf 100644 --- a/openassessment/workflow/test/test_workflow_batch_update_api.py +++ b/openassessment/workflow/test/test_workflow_batch_update_api.py @@ -31,6 +31,7 @@ def test_get_blocked_peer_workflows(self): _tim_sub, _tim = self._create_student_and_submission("Tim", "Tim's answer") self._create_student_and_submission("Miles", "Miles's answer") _pat_sub, _pat = self._create_student_and_submission("Pat", "Pat's answer") + _wayne_sub, _wayne = self._create_student_and_submission("Wayne", "Wayne's answer") blocked = update_api.get_blocked_peer_workflows() # we expect 0 blocked submissions as they were just created @@ -42,8 +43,14 @@ def test_get_blocked_peer_workflows(self): pw_tim.created_at = timezone.now() - datetime.timedelta(days=8) pw_tim.completed_at = timezone.now() - datetime.timedelta(days=3) pw_tim.save() + # set Wayne's submission as cancelled + pw_wayne = PeerWorkflow.objects.get(student_id=_wayne["student_id"]) + pw_wayne.created_at = timezone.now() - datetime.timedelta(days=8) + pw_wayne.completed_at = timezone.now() - datetime.timedelta(days=3) + pw_wayne.cancelled_at = timezone.now() - datetime.timedelta(days=3) + pw_wayne.save() blocked = update_api.get_blocked_peer_workflows() - # we expect 1 blocked submission + # we expect 1 blocked submission (Tim's) self.assertEqual(len(blocked), 1) # set Pat's submission create_at date to >7 days ago and set completed_at date diff --git a/openassessment/workflow/workflow_batch_update_api.py b/openassessment/workflow/workflow_batch_update_api.py index c45b775a75..519bef3aa2 100644 --- a/openassessment/workflow/workflow_batch_update_api.py +++ b/openassessment/workflow/workflow_batch_update_api.py @@ -267,7 +267,8 @@ def get_blocked_peer_workflows(course_id=None, item_id=None, submission_uuid=Non filters = { 'created_at__lte': timezone.now() - datetime.timedelta(days=7), 'grading_completed_at__isnull': True, - 'completed_at__isnull': False + 'completed_at__isnull': False, + 'cancelled_at__isnull': True } if course_id is not None: filters['course_id'] = course_id diff --git a/package.json b/package.json index d13ae3160c..e74811a393 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "edx-ora2", - "version": "5.5.5", + "version": "5.5.6", "repository": "https://github.com/openedx/edx-ora2.git", "dependencies": { "@edx/frontend-build": "^6.1.1",