Commit 4313951d by J. Cliff Dyer

Fix polls 404 on disabled completion.

Calling runtime.handle('progress', ...) was causing a 404 error due to
the runtime handler.  It should be okay for xblocks to submit a
completion or progress event; they just shouldn't have it treated
specially.

EDUCATOR-1642
parent 8809fd86
......@@ -481,10 +481,13 @@ def get_module_system_for_user(
Returns None if no special processing is required.
"""
handlers = {
'completion': handle_completion_event,
'grade': handle_grade_event,
'progress': handle_deprecated_progress_event,
}
if completion_waffle.waffle().is_enabled(completion_waffle.ENABLE_COMPLETION_TRACKING):
handlers.update({
'completion': handle_completion_event,
'progress': handle_deprecated_progress_event,
})
return handlers.get(event_type)
def publish(block, event_type, event):
......
......@@ -624,7 +624,7 @@ class TestHandleXBlockCallback(SharedModuleStoreTestCase, LoginEnrollmentTestCas
content_type='application/json',
)
request.user = self.mock_user
with self.assertRaises(Http404):
with patch('lms.djangoapps.completion.models.BlockCompletionManager.submit_completion') as mock_complete:
render.handle_xblock_callback(
request,
unicode(course.id),
......@@ -632,6 +632,8 @@ class TestHandleXBlockCallback(SharedModuleStoreTestCase, LoginEnrollmentTestCas
signal,
'',
)
mock_complete.assert_not_called()
self.assertFalse(BlockCompletion.objects.filter(block_key=block.scope_ids.usage_id).exists())
@ddt.data(
('complete', {'completion': 0.625}, 0.625),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment