Commit 4e464ec6 by Eric Fischer Committed by GitHub

Merge pull request #14550 from edx/efischer/tnl-6559

Short-term fix for TNL-6559 task failures
parents c9f17428 06c34456
...@@ -57,6 +57,9 @@ def submissions_score_set_handler(sender, **kwargs): # pylint: disable=unused-a ...@@ -57,6 +57,9 @@ def submissions_score_set_handler(sender, **kwargs): # pylint: disable=unused-a
user = user_by_anonymous_id(kwargs['anonymous_user_id']) user = user_by_anonymous_id(kwargs['anonymous_user_id'])
if user is None: if user is None:
return return
if points_possible == 0:
# This scenario is known to not succeed, see TNL-6559 for details.
return
PROBLEM_WEIGHTED_SCORE_CHANGED.send( PROBLEM_WEIGHTED_SCORE_CHANGED.send(
sender=None, sender=None,
...@@ -100,6 +103,7 @@ def submissions_score_reset_handler(sender, **kwargs): # pylint: disable=unused ...@@ -100,6 +103,7 @@ def submissions_score_reset_handler(sender, **kwargs): # pylint: disable=unused
course_id=course_id, course_id=course_id,
usage_id=usage_id, usage_id=usage_id,
modified=kwargs['created_at'], modified=kwargs['created_at'],
score_deleted=True,
score_db_table=ScoreDatabaseTableEnum.submissions, score_db_table=ScoreDatabaseTableEnum.submissions,
) )
......
...@@ -130,9 +130,22 @@ class ScoreChangedSignalRelayTest(TestCase): ...@@ -130,9 +130,22 @@ class ScoreChangedSignalRelayTest(TestCase):
'modified': FROZEN_NOW_TIMESTAMP, 'modified': FROZEN_NOW_TIMESTAMP,
'score_db_table': 'submissions', 'score_db_table': 'submissions',
} }
if handler == submissions_score_reset_handler:
expected_set_kwargs['score_deleted'] = True
self.signal_mock.assert_called_once_with(**expected_set_kwargs) self.signal_mock.assert_called_once_with(**expected_set_kwargs)
self.get_user_mock.assert_called_once_with(kwargs['anonymous_user_id']) self.get_user_mock.assert_called_once_with(kwargs['anonymous_user_id'])
def test_tnl_6599_zero_possible_bug(self):
"""
Ensure that, if coming from the submissions API, signals indicating a
a possible score of 0 are swallowed for reasons outlined in TNL-6559.
"""
local_kwargs = SUBMISSION_SET_KWARGS.copy()
local_kwargs['points_earned'] = 0
local_kwargs['points_possible'] = 0
submissions_score_set_handler(None, **local_kwargs)
self.signal_mock.assert_not_called()
@ddt.data( @ddt.data(
[submissions_score_set_handler, SUBMISSION_SET_KWARGS], [submissions_score_set_handler, SUBMISSION_SET_KWARGS],
[submissions_score_reset_handler, SUBMISSION_RESET_KWARGS] [submissions_score_reset_handler, SUBMISSION_RESET_KWARGS]
......
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