def _create_subsection_grade(self, user_id, course_key, usage_key): """ Given a user_id, course_key, and subsection usage_key, creates a new ``PersistentSubsectionGrade``. """ course = get_course(course_key, depth=None) subsection = course.get_child(usage_key) if not subsection: raise Exception('Subsection with given usage_key does not exist.') user = USER_MODEL.objects.get(id=user_id) course_data = CourseData(user, course=course) subsection_grade = CreateSubsectionGrade(subsection, course_data.structure, {}, {}) return subsection_grade.update_or_create_model(user, force_update_subsections=True)
def _create_subsection_grade(user_id, course_key, usage_key): """ Given a user_id, course_key, and subsection usage_key, creates a new ``PersistentSubsectionGrade``. """ from lms.djangoapps.courseware.courses import get_course from django.contrib.auth import get_user_model course = get_course(course_key, depth=None) subsection = course.get_child(usage_key) if not subsection: raise Exception('Subsection with given usage_key does not exist.') user = get_user_model().objects.get(id=user_id) subsection_grade = CreateSubsectionGrade(subsection, course_data.CourseData(user, course=course).structure, {}, {}) return subsection_grade.update_or_create_model(user, force_update_subsections=True)
def _create_subsection_grade(self, user_id, course_key, usage_key): """ Given a user_id, course_key, and subsection usage_key, creates a new ``PersistentSubsectionGrade``. """ course = get_course(course_key, depth=None) subsection = course.get_child(usage_key) if not subsection: raise Exception('Subsection with given usage_key does not exist.') user = USER_MODEL.objects.get(id=user_id) course_data = CourseData(user, course=course) subsection_grade = CreateSubsectionGrade(subsection, course_data.structure, {}, {}) return subsection_grade.update_or_create_model( user, force_update_subsections=True)
def _create_subsection_grade(self, user, course, subsection): course_data = CourseData(user, course=course) subsection_grade = CreateSubsectionGrade(subsection, course_data.structure, {}, {}) return subsection_grade.update_or_create_model(user, force_update_subsections=True)
def _create_subsection_grade(self, user, course, subsection): course_data = CourseData(user, course=course) subsection_grade = CreateSubsectionGrade(subsection, course_data.structure, {}, {}) return subsection_grade.update_or_create_model( user, force_update_subsections=True)