From 7d71d0e085300d6911b7076487bd20b19750d422 Mon Sep 17 00:00:00 2001 From: Saqib Date: Thu, 14 Jan 2021 11:49:47 +0500 Subject: [PATCH] fix completion submission for old mongo keys (#81) --- completion_aggregator/__init__.py | 2 +- completion_aggregator/api/v0/views.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/completion_aggregator/__init__.py b/completion_aggregator/__init__.py index 04fa1712..c3df9e47 100644 --- a/completion_aggregator/__init__.py +++ b/completion_aggregator/__init__.py @@ -4,6 +4,6 @@ from __future__ import absolute_import, unicode_literals -__version__ = '3.0.0' +__version__ = '3.0.1' default_app_config = 'completion_aggregator.apps.CompletionAggregatorAppConfig' # pylint: disable=invalid-name diff --git a/completion_aggregator/api/v0/views.py b/completion_aggregator/api/v0/views.py index 8d7639dd..841276f6 100644 --- a/completion_aggregator/api/v0/views.py +++ b/completion_aggregator/api/v0/views.py @@ -426,6 +426,10 @@ def post(self, request, course_key, block_key): except (InvalidKeyError, compat.get_item_not_found_error()): return Response(status=status.HTTP_404_NOT_FOUND) + if block_key.course_key.run is None: + # Old mongo keys must be annotated with course run info before calling submit_completion + block_key = block_key.replace(course_key=course_key) + _, created = BlockCompletion.objects.submit_completion( user=request.user, block_key=block_key,