Fix Delete-Student-State CSM entry deletion
This commit is contained in:
@@ -4,7 +4,6 @@ Enrollment operations for use by instructor APIs.
|
||||
Does not include any access control, be sure to check access before calling.
|
||||
"""
|
||||
|
||||
import crum
|
||||
import json
|
||||
import logging
|
||||
from django.contrib.auth.models import User
|
||||
@@ -15,8 +14,6 @@ from django.utils.translation import override as override_language
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from courseware.models import StudentModule
|
||||
from courseware.model_data import FieldDataCache
|
||||
from courseware.module_render import get_module_for_descriptor
|
||||
from edxmako.shortcuts import render_to_string
|
||||
from lms.djangoapps.grades.scores import weighted_score
|
||||
from lms.djangoapps.grades.signals.signals import PROBLEM_SCORE_CHANGED
|
||||
@@ -298,37 +295,22 @@ def _fire_score_changed_for_block(course_id, student, block, module_state_key):
|
||||
noted below.
|
||||
"""
|
||||
if block and block.has_score:
|
||||
cache = FieldDataCache.cache_for_descriptor_descendents(
|
||||
course_id=course_id,
|
||||
user=student,
|
||||
descriptor=block,
|
||||
depth=0
|
||||
)
|
||||
# For implementation reasons, we need to pull the max_score from the XModule,
|
||||
# even though the data is not user-specific. Here we bind the data to the
|
||||
# current user.
|
||||
request = crum.get_current_request()
|
||||
module = get_module_for_descriptor(
|
||||
user=student,
|
||||
request=request,
|
||||
descriptor=block,
|
||||
field_data_cache=cache,
|
||||
course_key=course_id
|
||||
)
|
||||
max_score = module.max_score()
|
||||
max_score = block.max_score()
|
||||
if max_score is None:
|
||||
return
|
||||
else:
|
||||
points_earned, points_possible = weighted_score(0, max_score, getattr(module, 'weight', None))
|
||||
points_earned, points_possible = weighted_score(0, max_score, getattr(block, 'weight', None))
|
||||
else:
|
||||
points_earned, points_possible = 0, 0
|
||||
|
||||
PROBLEM_SCORE_CHANGED.send(
|
||||
sender=None,
|
||||
points_possible=points_possible,
|
||||
points_earned=points_earned,
|
||||
user_id=student.id,
|
||||
course_id=unicode(course_id),
|
||||
usage_id=unicode(module_state_key)
|
||||
usage_id=unicode(module_state_key),
|
||||
score_deleted=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user