Update has_database_updated_with_new_score to handle all block types
TNL-6331
This commit is contained in:
@@ -16,10 +16,8 @@ from django.utils.translation import override as override_language
|
||||
from eventtracking import tracker
|
||||
import pytz
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from courseware.models import StudentModule
|
||||
from edxmako.shortcuts import render_to_string
|
||||
from lms.djangoapps.grades.signals.signals import PROBLEM_RAW_SCORE_CHANGED
|
||||
from lms.djangoapps.grades.constants import ScoreDatabaseTableEnum
|
||||
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_api.models import UserPreference
|
||||
@@ -329,19 +327,22 @@ def _fire_score_changed_for_block(
|
||||
The earned points are always zero. We must retrieve the possible points
|
||||
from the XModule, as noted below. The effective time is now().
|
||||
"""
|
||||
if block and block.has_score and block.max_score() is not None:
|
||||
PROBLEM_RAW_SCORE_CHANGED.send(
|
||||
sender=None,
|
||||
raw_earned=0,
|
||||
raw_possible=block.max_score(),
|
||||
weight=getattr(block, 'weight', None),
|
||||
user_id=student.id,
|
||||
course_id=unicode(course_id),
|
||||
usage_id=unicode(module_state_key),
|
||||
score_deleted=True,
|
||||
only_if_higher=False,
|
||||
modified=datetime.now().replace(tzinfo=pytz.UTC),
|
||||
)
|
||||
if block and block.has_score:
|
||||
max_score = block.max_score()
|
||||
if max_score is not None:
|
||||
PROBLEM_RAW_SCORE_CHANGED.send(
|
||||
sender=None,
|
||||
raw_earned=0,
|
||||
raw_possible=max_score,
|
||||
weight=getattr(block, 'weight', None),
|
||||
user_id=student.id,
|
||||
course_id=unicode(course_id),
|
||||
usage_id=unicode(module_state_key),
|
||||
score_deleted=True,
|
||||
only_if_higher=False,
|
||||
modified=datetime.now().replace(tzinfo=pytz.UTC),
|
||||
score_db_table=ScoreDatabaseTableEnum.courseware_student_module,
|
||||
)
|
||||
|
||||
|
||||
def get_email_params(course, auto_enroll, secure=True, course_key=None, display_name=None):
|
||||
|
||||
Reference in New Issue
Block a user