Commit 56676d82 by Nimisha Asthagiri Committed by GitHub

Merge pull request #16077 from edx/naa/grades-refactor

Grades: move out of temporary new folder
parents 75c22f56 22edaf7d
...@@ -105,7 +105,7 @@ class CourseEndingTest(TestCase): ...@@ -105,7 +105,7 @@ class CourseEndingTest(TestCase):
) )
cert_status = {'status': 'generating', 'grade': '0.67', 'mode': 'honor'} cert_status = {'status': 'generating', 'grade': '0.67', 'mode': 'honor'}
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.read') as patch_persisted_grade: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.read') as patch_persisted_grade:
patch_persisted_grade.return_value = Mock(percent=1.0) patch_persisted_grade.return_value = Mock(percent=1.0)
self.assertEqual( self.assertEqual(
_cert_info(user, course, cert_status, course_mode), _cert_info(user, course, cert_status, course_mode),
...@@ -244,7 +244,7 @@ class CourseEndingTest(TestCase): ...@@ -244,7 +244,7 @@ class CourseEndingTest(TestCase):
else: else:
cert_status = {'status': 'generating', 'mode': 'honor'} cert_status = {'status': 'generating', 'mode': 'honor'}
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.read') as patch_persisted_grade: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.read') as patch_persisted_grade:
patch_persisted_grade.return_value = Mock(percent=persisted_grade) patch_persisted_grade.return_value = Mock(percent=persisted_grade)
self.assertEqual( self.assertEqual(
_cert_info(user, course, cert_status, course_mode), _cert_info(user, course, cert_status, course_mode),
...@@ -277,7 +277,7 @@ class CourseEndingTest(TestCase): ...@@ -277,7 +277,7 @@ class CourseEndingTest(TestCase):
course_mode = 'honor' course_mode = 'honor'
cert_status = {'status': 'generating', 'mode': 'honor'} cert_status = {'status': 'generating', 'mode': 'honor'}
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.read') as patch_persisted_grade: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.read') as patch_persisted_grade:
patch_persisted_grade.return_value = None patch_persisted_grade.return_value = None
self.assertEqual( self.assertEqual(
_cert_info(user, course, cert_status, course_mode), _cert_info(user, course, cert_status, course_mode),
......
...@@ -67,7 +67,7 @@ from django_comment_common.models import assign_role ...@@ -67,7 +67,7 @@ from django_comment_common.models import assign_role
from edxmako.shortcuts import render_to_response, render_to_string from edxmako.shortcuts import render_to_response, render_to_string
from eventtracking import tracker from eventtracking import tracker
from lms.djangoapps.commerce.utils import EcommerceService # pylint: disable=import-error from lms.djangoapps.commerce.utils import EcommerceService # pylint: disable=import-error
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification # pylint: disable=import-error from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification # pylint: disable=import-error
# Note that this lives in LMS, so this dependency should be refactored. # Note that this lives in LMS, so this dependency should be refactored.
from notification_prefs.views import enable_notifications from notification_prefs.views import enable_notifications
......
...@@ -48,7 +48,7 @@ from lms.djangoapps.ccx.utils import ( ...@@ -48,7 +48,7 @@ from lms.djangoapps.ccx.utils import (
parse_date, parse_date,
prep_course_for_grading prep_course_for_grading
) )
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.instructor.enrollment import enroll_email, get_email_params from lms.djangoapps.instructor.enrollment import enroll_email, get_email_params
from lms.djangoapps.instructor.views.api import _split_input_list from lms.djangoapps.instructor.views.api import _split_input_list
from lms.djangoapps.instructor.views.gradebook_api import get_grade_book_page from lms.djangoapps.instructor.views.gradebook_api import get_grade_book_page
......
...@@ -8,7 +8,7 @@ from django.core.management.base import BaseCommand ...@@ -8,7 +8,7 @@ from django.core.management.base import BaseCommand
from certificates.models import GeneratedCertificate from certificates.models import GeneratedCertificate
from courseware import courses from courseware import courses
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -21,7 +21,7 @@ from certificates.models import ( ...@@ -21,7 +21,7 @@ from certificates.models import (
certificate_status_for_student certificate_status_for_student
) )
from course_modes.models import CourseMode from course_modes.models import CourseMode
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
from student.models import CourseEnrollment, UserProfile from student.models import CourseEnrollment, UserProfile
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
......
...@@ -13,7 +13,7 @@ from certificates.models import ( ...@@ -13,7 +13,7 @@ from certificates.models import (
GeneratedCertificate GeneratedCertificate
) )
from certificates.tasks import generate_certificate from certificates.tasks import generate_certificate
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
from openedx.core.djangoapps.certificates.api import auto_certificate_generation_enabled from openedx.core.djangoapps.certificates.api import auto_certificate_generation_enabled
from openedx.core.djangoapps.certificates.config import waffle from openedx.core.djangoapps.certificates.config import waffle
......
...@@ -11,7 +11,7 @@ from certificates.models import ( ...@@ -11,7 +11,7 @@ from certificates.models import (
GeneratedCertificate, GeneratedCertificate,
CertificateStatuses, CertificateStatuses,
) )
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.grades.tests.utils import mock_passing_grade from lms.djangoapps.grades.tests.utils import mock_passing_grade
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
from openedx.core.djangoapps.certificates.config import waffle from openedx.core.djangoapps.certificates.config import waffle
......
...@@ -28,7 +28,7 @@ from capa.tests.response_xml_factory import ( ...@@ -28,7 +28,7 @@ from capa.tests.response_xml_factory import (
from course_modes.models import CourseMode from course_modes.models import CourseMode
from courseware.models import BaseStudentModuleHistory, StudentModule from courseware.models import BaseStudentModuleHistory, StudentModule
from courseware.tests.helpers import LoginEnrollmentTestCase from courseware.tests.helpers import LoginEnrollmentTestCase
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from openedx.core.djangoapps.credit.api import get_credit_requirement_status, set_credit_requirements from openedx.core.djangoapps.credit.api import get_credit_requirement_status, set_credit_requirements
from openedx.core.djangoapps.credit.models import CreditCourse, CreditProvider from openedx.core.djangoapps.credit.models import CreditCourse, CreditProvider
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
......
...@@ -42,7 +42,7 @@ from django.test.utils import override_settings ...@@ -42,7 +42,7 @@ from django.test.utils import override_settings
from lms.djangoapps.commerce.utils import EcommerceService # pylint: disable=import-error from lms.djangoapps.commerce.utils import EcommerceService # pylint: disable=import-error
from lms.djangoapps.grades.config.waffle import waffle as grades_waffle from lms.djangoapps.grades.config.waffle import waffle as grades_waffle
from lms.djangoapps.grades.config.waffle import ASSUME_ZERO_GRADE_IF_ABSENT from lms.djangoapps.grades.config.waffle import ASSUME_ZERO_GRADE_IF_ABSENT
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.grades.tests.utils import mock_get_score from lms.djangoapps.grades.tests.utils import mock_get_score
from milestones.tests.utils import MilestonesTestCaseMixin from milestones.tests.utils import MilestonesTestCaseMixin
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
...@@ -1399,7 +1399,7 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1399,7 +1399,7 @@ class ProgressPageTests(ProgressPageBaseTests):
self.course.save() self.course.save()
self.store.update_item(self.course, self.user.id) self.store.update_item(self.course, self.user.id)
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') as mock_create: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create') as mock_create:
course_grade = mock_create.return_value course_grade = mock_create.return_value
course_grade.passed = True course_grade.passed = True
course_grade.summary = {'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}} course_grade.summary = {'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}}
...@@ -1442,7 +1442,7 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1442,7 +1442,7 @@ class ProgressPageTests(ProgressPageBaseTests):
# Enable certificate generation for this course # Enable certificate generation for this course
certs_api.set_cert_generation_enabled(self.course.id, True) certs_api.set_cert_generation_enabled(self.course.id, True)
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') as mock_create: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create') as mock_create:
course_grade = mock_create.return_value course_grade = mock_create.return_value
course_grade.passed = True course_grade.passed = True
course_grade.summary = {'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}} course_grade.summary = {'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}}
...@@ -1504,7 +1504,7 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1504,7 +1504,7 @@ class ProgressPageTests(ProgressPageBaseTests):
'lms.djangoapps.verify_student.models.SoftwareSecurePhotoVerification.user_is_verified' 'lms.djangoapps.verify_student.models.SoftwareSecurePhotoVerification.user_is_verified'
) as user_verify: ) as user_verify:
user_verify.return_value = user_verified user_verify.return_value = user_verified
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') as mock_create: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create') as mock_create:
course_grade = mock_create.return_value course_grade = mock_create.return_value
course_grade.passed = True course_grade.passed = True
course_grade.summary = { course_grade.summary = {
...@@ -1548,7 +1548,7 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1548,7 +1548,7 @@ class ProgressPageTests(ProgressPageBaseTests):
self.course.save() self.course.save()
self.store.update_item(self.course, self.user.id) self.store.update_item(self.course, self.user.id)
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') as mock_create: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create') as mock_create:
course_grade = mock_create.return_value course_grade = mock_create.return_value
course_grade.passed = True course_grade.passed = True
course_grade.summary = { course_grade.summary = {
...@@ -1568,7 +1568,7 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1568,7 +1568,7 @@ class ProgressPageTests(ProgressPageBaseTests):
"http://www.example.com/certificate.pdf", "honor" "http://www.example.com/certificate.pdf", "honor"
) )
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') as mock_create: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create') as mock_create:
course_grade = mock_create.return_value course_grade = mock_create.return_value
course_grade.passed = True course_grade.passed = True
course_grade.summary = {'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}} course_grade.summary = {'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}}
...@@ -1586,7 +1586,7 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1586,7 +1586,7 @@ class ProgressPageTests(ProgressPageBaseTests):
self.assertTrue(self.client.login(username=user.username, password='test')) self.assertTrue(self.client.login(username=user.username, password='test'))
CourseEnrollmentFactory(user=user, course_id=self.course.id, mode=CourseMode.AUDIT) CourseEnrollmentFactory(user=user, course_id=self.course.id, mode=CourseMode.AUDIT)
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') as mock_create: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create') as mock_create:
course_grade = mock_create.return_value course_grade = mock_create.return_value
course_grade.passed = True course_grade.passed = True
course_grade.summary = {'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}} course_grade.summary = {'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}}
...@@ -2090,7 +2090,7 @@ class GenerateUserCertTests(ModuleStoreTestCase): ...@@ -2090,7 +2090,7 @@ class GenerateUserCertTests(ModuleStoreTestCase):
status=CertificateStatuses.generating, status=CertificateStatuses.generating,
mode='verified' mode='verified'
) )
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') as mock_create: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create') as mock_create:
course_grade = mock_create.return_value course_grade = mock_create.return_value
course_grade.passed = True course_grade.passed = True
course_grade.summary = {'grade': 'Pass', 'percent': 0.75} course_grade.summary = {'grade': 'Pass', 'percent': 0.75}
...@@ -2111,7 +2111,7 @@ class GenerateUserCertTests(ModuleStoreTestCase): ...@@ -2111,7 +2111,7 @@ class GenerateUserCertTests(ModuleStoreTestCase):
mode='verified' mode='verified'
) )
with patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') as mock_create: with patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create') as mock_create:
course_grade = mock_create.return_value course_grade = mock_create.return_value
course_grade.passed = True course_grade.passed = True
course_grade.summay = {'grade': 'Pass', 'percent': 0.75} course_grade.summay = {'grade': 'Pass', 'percent': 0.75}
......
...@@ -24,7 +24,7 @@ from edxmako.shortcuts import render_to_response, render_to_string ...@@ -24,7 +24,7 @@ from edxmako.shortcuts import render_to_response, render_to_string
from lms.djangoapps.courseware.exceptions import CourseAccessRedirect from lms.djangoapps.courseware.exceptions import CourseAccessRedirect
from lms.djangoapps.experiments.utils import get_experiment_user_metadata_context from lms.djangoapps.experiments.utils import get_experiment_user_metadata_context
from lms.djangoapps.gating.api import get_entrance_exam_score_ratio, get_entrance_exam_usage_key from lms.djangoapps.gating.api import get_entrance_exam_score_ratio, get_entrance_exam_usage_key
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from openedx.core.djangoapps.crawlers.models import CrawlersConfig from openedx.core.djangoapps.crawlers.models import CrawlersConfig
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
from openedx.core.djangoapps.monitoring_utils import set_custom_metrics_for_course_key from openedx.core.djangoapps.monitoring_utils import set_custom_metrics_for_course_key
......
...@@ -63,7 +63,7 @@ from lms.djangoapps.ccx.custom_exception import CCXLocatorValidationException ...@@ -63,7 +63,7 @@ from lms.djangoapps.ccx.custom_exception import CCXLocatorValidationException
from lms.djangoapps.ccx.utils import prep_course_for_grading from lms.djangoapps.ccx.utils import prep_course_for_grading
from lms.djangoapps.courseware.exceptions import CourseAccessRedirect, Redirect from lms.djangoapps.courseware.exceptions import CourseAccessRedirect, Redirect
from lms.djangoapps.experiments.utils import get_experiment_user_metadata_context from lms.djangoapps.experiments.utils import get_experiment_user_metadata_context
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.instructor.enrollment import uses_shib from lms.djangoapps.instructor.enrollment import uses_shib
from lms.djangoapps.instructor.views.api import require_global_staff from lms.djangoapps.instructor.views.api import require_global_staff
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
......
...@@ -7,7 +7,7 @@ from milestones.tests.utils import MilestonesTestCaseMixin ...@@ -7,7 +7,7 @@ from milestones.tests.utils import MilestonesTestCaseMixin
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from lms.djangoapps.courseware.access import has_access from lms.djangoapps.courseware.access import has_access
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.grades.tests.utils import answer_problem from lms.djangoapps.grades.tests.utils import answer_problem
from openedx.core.djangolib.testing.utils import get_mock_request from openedx.core.djangolib.testing.utils import get_mock_request
from openedx.core.lib.gating import api as gating_api from openedx.core.lib.gating import api as gating_api
......
...@@ -15,7 +15,7 @@ from lms.djangoapps.ccx.utils import prep_course_for_grading ...@@ -15,7 +15,7 @@ from lms.djangoapps.ccx.utils import prep_course_for_grading
from lms.djangoapps.courseware import courses from lms.djangoapps.courseware import courses
from lms.djangoapps.courseware.exceptions import CourseAccessRedirect from lms.djangoapps.courseware.exceptions import CourseAccessRedirect
from lms.djangoapps.grades.api.serializers import GradingPolicySerializer from lms.djangoapps.grades.api.serializers import GradingPolicySerializer
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes
from student.roles import CourseStaffRole from student.roles import CourseStaffRole
......
...@@ -2,7 +2,7 @@ from lms.djangoapps.course_blocks.api import get_course_blocks ...@@ -2,7 +2,7 @@ from lms.djangoapps.course_blocks.api import get_course_blocks
from openedx.core.djangoapps.content.block_structure.api import get_block_structure_manager from openedx.core.djangoapps.content.block_structure.api import get_block_structure_manager
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from ..transformer import GradesTransformer from .transformer import GradesTransformer
class CourseData(object): class CourseData(object):
......
...@@ -6,11 +6,11 @@ import dogstats_wrapper as dog_stats_api ...@@ -6,11 +6,11 @@ import dogstats_wrapper as dog_stats_api
from openedx.core.djangoapps.signals.signals import COURSE_GRADE_CHANGED, COURSE_GRADE_NOW_PASSED from openedx.core.djangoapps.signals.signals import COURSE_GRADE_CHANGED, COURSE_GRADE_NOW_PASSED
from ..config import assume_zero_if_absent, should_persist_grades from .config import assume_zero_if_absent, should_persist_grades
from ..config.waffle import WRITE_ONLY_IF_ENGAGED, waffle from .config.waffle import WRITE_ONLY_IF_ENGAGED, waffle
from ..models import PersistentCourseGrade, VisibleBlocks
from .course_data import CourseData from .course_data import CourseData
from .course_grade import CourseGrade, ZeroCourseGrade from .course_grade import CourseGrade, ZeroCourseGrade
from .models import PersistentCourseGrade, VisibleBlocks
log = getLogger(__name__) log = getLogger(__name__)
......
...@@ -4,11 +4,9 @@ Grades related signals. ...@@ -4,11 +4,9 @@ Grades related signals.
from contextlib import contextmanager from contextlib import contextmanager
from logging import getLogger from logging import getLogger
from courseware.model_data import get_score, set_score
from crum import get_current_user from crum import get_current_user
from django.dispatch import receiver from django.dispatch import receiver
from xblock.scorable import ScorableXBlockMixin, Score
from courseware.model_data import get_score, set_score
from eventtracking import tracker from eventtracking import tracker
from lms.djangoapps.instructor_task.tasks_helper.module_state import GRADES_OVERRIDE_EVENT_TYPE from lms.djangoapps.instructor_task.tasks_helper.module_state import GRADES_OVERRIDE_EVENT_TYPE
from openedx.core.djangoapps.course_groups.signals.signals import COHORT_MEMBERSHIP_UPDATED from openedx.core.djangoapps.course_groups.signals.signals import COHORT_MEMBERSHIP_UPDATED
...@@ -23,12 +21,8 @@ from track.event_transaction_utils import ( ...@@ -23,12 +21,8 @@ from track.event_transaction_utils import (
set_event_transaction_type set_event_transaction_type
) )
from util.date_utils import to_timestamp from util.date_utils import to_timestamp
from xblock.scorable import ScorableXBlockMixin, Score
from ..config.waffle import waffle, WRITE_ONLY_IF_ENGAGED
from ..constants import ScoreDatabaseTableEnum
from ..new.course_grade_factory import CourseGradeFactory
from ..scores import weighted_score
from ..tasks import RECALCULATE_GRADE_DELAY, recalculate_subsection_grade_v3
from .signals import ( from .signals import (
PROBLEM_RAW_SCORE_CHANGED, PROBLEM_RAW_SCORE_CHANGED,
PROBLEM_WEIGHTED_SCORE_CHANGED, PROBLEM_WEIGHTED_SCORE_CHANGED,
...@@ -36,6 +30,11 @@ from .signals import ( ...@@ -36,6 +30,11 @@ from .signals import (
SUBSECTION_SCORE_CHANGED, SUBSECTION_SCORE_CHANGED,
SUBSECTION_OVERRIDE_CHANGED, SUBSECTION_OVERRIDE_CHANGED,
) )
from ..config.waffle import waffle, WRITE_ONLY_IF_ENGAGED
from ..constants import ScoreDatabaseTableEnum
from ..course_grade_factory import CourseGradeFactory
from ..scores import weighted_score
from ..tasks import RECALCULATE_GRADE_DELAY, recalculate_subsection_grade_v3
log = getLogger(__name__) log = getLogger(__name__)
......
...@@ -11,7 +11,7 @@ from lms.djangoapps.grades.scores import get_score, possibly_scored ...@@ -11,7 +11,7 @@ from lms.djangoapps.grades.scores import get_score, possibly_scored
from xmodule import block_metadata_utils, graders from xmodule import block_metadata_utils, graders
from xmodule.graders import AggregatedScore, ShowCorrectness from xmodule.graders import AggregatedScore, ShowCorrectness
from ..config.waffle import WRITE_ONLY_IF_ENGAGED, waffle from .config.waffle import WRITE_ONLY_IF_ENGAGED, waffle
log = getLogger(__name__) log = getLogger(__name__)
......
...@@ -8,17 +8,16 @@ import six ...@@ -8,17 +8,16 @@ import six
from celery import task from celery import task
from celery_utils.logged_task import LoggedTask from celery_utils.logged_task import LoggedTask
from celery_utils.persist_on_failure import PersistOnFailureTask from celery_utils.persist_on_failure import PersistOnFailureTask
from courseware.model_data import get_score
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db.utils import DatabaseError from django.db.utils import DatabaseError
from opaque_keys.edx.keys import CourseKey, UsageKey
from opaque_keys.edx.locator import CourseLocator
from courseware.model_data import get_score
from lms.djangoapps.course_blocks.api import get_course_blocks from lms.djangoapps.course_blocks.api import get_course_blocks
from lms.djangoapps.courseware import courses from lms.djangoapps.courseware import courses
from lms.djangoapps.grades.config.models import ComputeGradesSetting from lms.djangoapps.grades.config.models import ComputeGradesSetting
from opaque_keys.edx.keys import CourseKey, UsageKey
from opaque_keys.edx.locator import CourseLocator
from openedx.core.djangoapps.monitoring_utils import set_custom_metric, set_custom_metrics_for_course_key from openedx.core.djangoapps.monitoring_utils import set_custom_metric, set_custom_metrics_for_course_key
from student.models import CourseEnrollment from student.models import CourseEnrollment
from submissions import api as sub_api from submissions import api as sub_api
...@@ -28,11 +27,11 @@ from xmodule.modulestore.django import modulestore ...@@ -28,11 +27,11 @@ from xmodule.modulestore.django import modulestore
from .config.waffle import ESTIMATE_FIRST_ATTEMPTED, DISABLE_REGRADE_ON_POLICY_CHANGE, waffle from .config.waffle import ESTIMATE_FIRST_ATTEMPTED, DISABLE_REGRADE_ON_POLICY_CHANGE, waffle
from .constants import ScoreDatabaseTableEnum from .constants import ScoreDatabaseTableEnum
from .course_grade_factory import CourseGradeFactory
from .exceptions import DatabaseNotReadyError from .exceptions import DatabaseNotReadyError
from .new.course_grade_factory import CourseGradeFactory
from .new.subsection_grade_factory import SubsectionGradeFactory
from .services import GradesService from .services import GradesService
from .signals.signals import SUBSECTION_SCORE_CHANGED from .signals.signals import SUBSECTION_SCORE_CHANGED
from .subsection_grade_factory import SubsectionGradeFactory
from .transformer import GradesTransformer from .transformer import GradesTransformer
log = getLogger(__name__) log = getLogger(__name__)
......
...@@ -14,7 +14,7 @@ from xmodule.modulestore.django import modulestore ...@@ -14,7 +14,7 @@ from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from ...new.subsection_grade_factory import SubsectionGradeFactory from ...subsection_grade_factory import SubsectionGradeFactory
class GradesAccessIntegrationTest(ProblemSubmissionTestMixin, SharedModuleStoreTestCase): class GradesAccessIntegrationTest(ProblemSubmissionTestMixin, SharedModuleStoreTestCase):
......
""" """
Tests for CourseData utility class. Tests for CourseData utility class.
""" """
from mock import patch
from lms.djangoapps.course_blocks.api import get_course_blocks from lms.djangoapps.course_blocks.api import get_course_blocks
from mock import patch
from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
from ..new.course_data import CourseData from ..course_data import CourseData
class CourseDataTest(ModuleStoreTestCase): class CourseDataTest(ModuleStoreTestCase):
...@@ -37,7 +36,7 @@ class CourseDataTest(ModuleStoreTestCase): ...@@ -37,7 +36,7 @@ class CourseDataTest(ModuleStoreTestCase):
'location': self.course.location, 'location': self.course.location,
} }
@patch('lms.djangoapps.grades.new.course_data.get_course_blocks') @patch('lms.djangoapps.grades.course_data.get_course_blocks')
def test_fill_course_data(self, mock_get_blocks): def test_fill_course_data(self, mock_get_blocks):
""" """
Tests to ensure that course data is fully filled with just a single input. Tests to ensure that course data is fully filled with just a single input.
......
...@@ -6,11 +6,10 @@ import datetime ...@@ -6,11 +6,10 @@ import datetime
import itertools import itertools
import ddt import ddt
from mock import patch
from nose.plugins.attrib import attr
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from lms.djangoapps.course_blocks.api import get_course_blocks from lms.djangoapps.course_blocks.api import get_course_blocks
from mock import patch
from nose.plugins.attrib import attr
from openedx.core.djangoapps.content.block_structure.factory import BlockStructureFactory from openedx.core.djangoapps.content.block_structure.factory import BlockStructureFactory
from openedx.core.djangolib.testing.utils import get_mock_request from openedx.core.djangolib.testing.utils import get_mock_request
from student.models import CourseEnrollment from student.models import CourseEnrollment
...@@ -20,8 +19,8 @@ from xmodule.modulestore import ModuleStoreEnum ...@@ -20,8 +19,8 @@ from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from ..new.course_grade_factory import CourseGradeFactory from ..course_grade_factory import CourseGradeFactory
from ..new.subsection_grade_factory import SubsectionGradeFactory from ..subsection_grade_factory import SubsectionGradeFactory
from .utils import answer_problem from .utils import answer_problem
...@@ -80,7 +79,7 @@ class TestGradeIteration(SharedModuleStoreTestCase): ...@@ -80,7 +79,7 @@ class TestGradeIteration(SharedModuleStoreTestCase):
self.assertIsNone(course_grade.letter_grade) self.assertIsNone(course_grade.letter_grade)
self.assertEqual(course_grade.percent, 0.0) self.assertEqual(course_grade.percent, 0.0)
@patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.create') @patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.create')
def test_grading_exception(self, mock_course_grade): def test_grading_exception(self, mock_course_grade):
"""Test that we correctly capture exception messages that bubble up from """Test that we correctly capture exception messages that bubble up from
grading. Note that we only see errors at this level if the grading grading. Note that we only see errors at this level if the grading
......
...@@ -8,14 +8,13 @@ import itertools ...@@ -8,14 +8,13 @@ import itertools
import ddt import ddt
import pytz import pytz
from django.conf import settings
from mock import patch
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from courseware.access import has_access from courseware.access import has_access
from courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin from courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin
from django.conf import settings
from lms.djangoapps.course_blocks.api import get_course_blocks from lms.djangoapps.course_blocks.api import get_course_blocks
from lms.djangoapps.grades.config.tests.utils import persistent_grades_feature_flags from lms.djangoapps.grades.config.tests.utils import persistent_grades_feature_flags
from mock import patch
from openedx.core.djangolib.testing.utils import get_mock_request from openedx.core.djangolib.testing.utils import get_mock_request
from student.models import CourseEnrollment from student.models import CourseEnrollment
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
...@@ -25,12 +24,12 @@ from xmodule.modulestore.tests.utils import TEST_DATA_DIR ...@@ -25,12 +24,12 @@ from xmodule.modulestore.tests.utils import TEST_DATA_DIR
from xmodule.modulestore.xml_importer import import_course_from_xml from xmodule.modulestore.xml_importer import import_course_from_xml
from ..config.waffle import ASSUME_ZERO_GRADE_IF_ABSENT, WRITE_ONLY_IF_ENGAGED, waffle from ..config.waffle import ASSUME_ZERO_GRADE_IF_ABSENT, WRITE_ONLY_IF_ENGAGED, waffle
from ..course_data import CourseData
from ..course_grade import CourseGrade, ZeroCourseGrade
from ..course_grade_factory import CourseGradeFactory
from ..models import PersistentSubsectionGrade from ..models import PersistentSubsectionGrade
from ..new.course_data import CourseData from ..subsection_grade import SubsectionGrade, ZeroSubsectionGrade
from ..new.course_grade import CourseGrade, ZeroCourseGrade from ..subsection_grade_factory import SubsectionGradeFactory
from ..new.course_grade_factory import CourseGradeFactory
from ..new.subsection_grade import SubsectionGrade, ZeroSubsectionGrade
from ..new.subsection_grade_factory import SubsectionGradeFactory
from .utils import mock_get_score, mock_get_submissions_score from .utils import mock_get_score, mock_get_submissions_score
...@@ -248,7 +247,7 @@ class TestCourseGradeFactory(GradeTestBase): ...@@ -248,7 +247,7 @@ class TestCourseGradeFactory(GradeTestBase):
@ddt.data(True, False) @ddt.data(True, False)
def test_iter_force_update(self, force_update): def test_iter_force_update(self, force_update):
base_string = 'lms.djangoapps.grades.new.subsection_grade_factory.SubsectionGradeFactory.{}' base_string = 'lms.djangoapps.grades.subsection_grade_factory.SubsectionGradeFactory.{}'
desired_method_name = base_string.format('update' if force_update else 'create') desired_method_name = base_string.format('update' if force_update else 'create')
undesired_method_name = base_string.format('create' if force_update else 'update') undesired_method_name = base_string.format('create' if force_update else 'update')
with patch(desired_method_name) as desired_call: with patch(desired_method_name) as desired_call:
...@@ -295,11 +294,11 @@ class TestSubsectionGradeFactory(ProblemSubmissionTestMixin, GradeTestBase): ...@@ -295,11 +294,11 @@ class TestSubsectionGradeFactory(ProblemSubmissionTestMixin, GradeTestBase):
created, saved, then fetched on re-request. created, saved, then fetched on re-request.
""" """
with patch( with patch(
'lms.djangoapps.grades.new.subsection_grade.PersistentSubsectionGrade.create_grade', 'lms.djangoapps.grades.subsection_grade.PersistentSubsectionGrade.create_grade',
wraps=PersistentSubsectionGrade.create_grade wraps=PersistentSubsectionGrade.create_grade
) as mock_create_grade: ) as mock_create_grade:
with patch( with patch(
'lms.djangoapps.grades.new.subsection_grade_factory.SubsectionGradeFactory._get_bulk_cached_grade', 'lms.djangoapps.grades.subsection_grade_factory.SubsectionGradeFactory._get_bulk_cached_grade',
wraps=self.subsection_grade_factory._get_bulk_cached_grade wraps=self.subsection_grade_factory._get_bulk_cached_grade
) as mock_get_bulk_cached_grade: ) as mock_get_bulk_cached_grade:
with self.assertNumQueries(14): with self.assertNumQueries(14):
...@@ -412,7 +411,7 @@ class ZeroGradeTest(GradeTestBase): ...@@ -412,7 +411,7 @@ class ZeroGradeTest(GradeTestBase):
Creates a zero course grade and ensures that null scores aren't included in the section problem scores. Creates a zero course grade and ensures that null scores aren't included in the section problem scores.
""" """
with waffle().override(ASSUME_ZERO_GRADE_IF_ABSENT, active=assume_zero_enabled): with waffle().override(ASSUME_ZERO_GRADE_IF_ABSENT, active=assume_zero_enabled):
with patch('lms.djangoapps.grades.new.subsection_grade.get_score', return_value=None): with patch('lms.djangoapps.grades.subsection_grade.get_score', return_value=None):
course_data = CourseData(self.request.user, structure=self.course_structure) course_data = CourseData(self.request.user, structure=self.course_structure)
chapter_grades = ZeroCourseGrade(self.request.user, course_data).chapter_grades chapter_grades = ZeroCourseGrade(self.request.user, course_data).chapter_grades
for chapter in chapter_grades: for chapter in chapter_grades:
...@@ -744,7 +743,7 @@ class TestCourseGradeLogging(ProblemSubmissionTestMixin, SharedModuleStoreTestCa ...@@ -744,7 +743,7 @@ class TestCourseGradeLogging(ProblemSubmissionTestMixin, SharedModuleStoreTestCa
course_id=self.course.id, course_id=self.course.id,
enabled_for_course=True enabled_for_course=True
): ):
with patch('lms.djangoapps.grades.new.course_grade_factory.log') as log_mock: with patch('lms.djangoapps.grades.course_grade_factory.log') as log_mock:
# read, but not persisted # read, but not persisted
self._create_course_grade_and_check_logging(grade_factory.create, log_mock.info, u'Update') self._create_course_grade_and_check_logging(grade_factory.create, log_mock.info, u'Update')
......
...@@ -253,7 +253,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest ...@@ -253,7 +253,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
self.assertGreater(len(PersistentSubsectionGrade.bulk_read_grades(self.user.id, self.course.id)), 0) self.assertGreater(len(PersistentSubsectionGrade.bulk_read_grades(self.user.id, self.course.id)), 0)
@patch('lms.djangoapps.grades.signals.signals.SUBSECTION_SCORE_CHANGED.send') @patch('lms.djangoapps.grades.signals.signals.SUBSECTION_SCORE_CHANGED.send')
@patch('lms.djangoapps.grades.new.subsection_grade_factory.SubsectionGradeFactory.update') @patch('lms.djangoapps.grades.subsection_grade_factory.SubsectionGradeFactory.update')
def test_retry_first_time_only(self, mock_update, mock_course_signal): def test_retry_first_time_only(self, mock_update, mock_course_signal):
""" """
Ensures that a task retry completes after a one-time failure. Ensures that a task retry completes after a one-time failure.
...@@ -264,7 +264,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest ...@@ -264,7 +264,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
self.assertEquals(mock_course_signal.call_count, 1) self.assertEquals(mock_course_signal.call_count, 1)
@patch('lms.djangoapps.grades.tasks.recalculate_subsection_grade_v3.retry') @patch('lms.djangoapps.grades.tasks.recalculate_subsection_grade_v3.retry')
@patch('lms.djangoapps.grades.new.subsection_grade_factory.SubsectionGradeFactory.update') @patch('lms.djangoapps.grades.subsection_grade_factory.SubsectionGradeFactory.update')
def test_retry_on_integrity_error(self, mock_update, mock_retry): def test_retry_on_integrity_error(self, mock_update, mock_retry):
""" """
Ensures that tasks will be retried if IntegrityErrors are encountered. Ensures that tasks will be retried if IntegrityErrors are encountered.
...@@ -347,7 +347,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest ...@@ -347,7 +347,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
@patch('lms.djangoapps.grades.tasks.log') @patch('lms.djangoapps.grades.tasks.log')
@patch('lms.djangoapps.grades.tasks.recalculate_subsection_grade_v3.retry') @patch('lms.djangoapps.grades.tasks.recalculate_subsection_grade_v3.retry')
@patch('lms.djangoapps.grades.new.subsection_grade_factory.SubsectionGradeFactory.update') @patch('lms.djangoapps.grades.subsection_grade_factory.SubsectionGradeFactory.update')
def test_log_unknown_error(self, mock_update, mock_retry, mock_log): def test_log_unknown_error(self, mock_update, mock_retry, mock_log):
""" """
Ensures that unknown errors are logged before a retry. Ensures that unknown errors are logged before a retry.
...@@ -360,7 +360,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest ...@@ -360,7 +360,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
@patch('lms.djangoapps.grades.tasks.log') @patch('lms.djangoapps.grades.tasks.log')
@patch('lms.djangoapps.grades.tasks.recalculate_subsection_grade_v3.retry') @patch('lms.djangoapps.grades.tasks.recalculate_subsection_grade_v3.retry')
@patch('lms.djangoapps.grades.new.subsection_grade_factory.SubsectionGradeFactory.update') @patch('lms.djangoapps.grades.subsection_grade_factory.SubsectionGradeFactory.update')
def test_no_log_known_error(self, mock_update, mock_retry, mock_log): def test_no_log_known_error(self, mock_update, mock_retry, mock_log):
""" """
Ensures that known errors are not logged before a retry. Ensures that known errors are not logged before a retry.
......
...@@ -16,8 +16,8 @@ def mock_passing_grade(grade_pass='Pass', percent=0.75, ): ...@@ -16,8 +16,8 @@ def mock_passing_grade(grade_pass='Pass', percent=0.75, ):
""" """
Mock the grading function to always return a passing grade. Mock the grading function to always return a passing grade.
""" """
with patch('lms.djangoapps.grades.new.course_grade.CourseGrade._compute_letter_grade') as mock_letter_grade: with patch('lms.djangoapps.grades.course_grade.CourseGrade._compute_letter_grade') as mock_letter_grade:
with patch('lms.djangoapps.grades.new.course_grade.CourseGrade._compute_percent') as mock_percent_grade: with patch('lms.djangoapps.grades.course_grade.CourseGrade._compute_percent') as mock_percent_grade:
mock_letter_grade.return_value = grade_pass mock_letter_grade.return_value = grade_pass
mock_percent_grade.return_value = percent mock_percent_grade.return_value = percent
yield yield
...@@ -28,7 +28,7 @@ def mock_get_score(earned=0, possible=1, first_attempted=datetime(2000, 1, 1, 0, ...@@ -28,7 +28,7 @@ def mock_get_score(earned=0, possible=1, first_attempted=datetime(2000, 1, 1, 0,
""" """
Mocks the get_score function to return a valid grade. Mocks the get_score function to return a valid grade.
""" """
with patch('lms.djangoapps.grades.new.subsection_grade.get_score') as mock_score: with patch('lms.djangoapps.grades.subsection_grade.get_score') as mock_score:
mock_score.return_value = ProblemScore( mock_score.return_value = ProblemScore(
raw_earned=earned, raw_earned=earned,
raw_possible=possible, raw_possible=possible,
......
...@@ -17,7 +17,7 @@ from opaque_keys.edx.locator import CourseLocator ...@@ -17,7 +17,7 @@ from opaque_keys.edx.locator import CourseLocator
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from courseware.models import StudentModule from courseware.models import StudentModule
from grades.new.subsection_grade_factory import SubsectionGradeFactory from grades.subsection_grade_factory import SubsectionGradeFactory
from grades.tests.utils import answer_problem from grades.tests.utils import answer_problem
from lms.djangoapps.ccx.tests.factories import CcxFactory from lms.djangoapps.ccx.tests.factories import CcxFactory
from lms.djangoapps.course_blocks.api import get_course_blocks from lms.djangoapps.course_blocks.api import get_course_blocks
......
...@@ -12,7 +12,7 @@ from opaque_keys.edx.keys import CourseKey ...@@ -12,7 +12,7 @@ from opaque_keys.edx.keys import CourseKey
from courseware.courses import get_course_with_access from courseware.courses import get_course_with_access
from edxmako.shortcuts import render_to_response from edxmako.shortcuts import render_to_response
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.instructor.views.api import require_level from lms.djangoapps.instructor.views.api import require_level
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
......
...@@ -17,7 +17,7 @@ from instructor_analytics.basic import list_problem_responses ...@@ -17,7 +17,7 @@ from instructor_analytics.basic import list_problem_responses
from instructor_analytics.csvs import format_dictlist from instructor_analytics.csvs import format_dictlist
from lms.djangoapps.grades.context import grading_context, grading_context_for_course from lms.djangoapps.grades.context import grading_context, grading_context_for_course
from lms.djangoapps.grades.models import PersistentCourseGrade from lms.djangoapps.grades.models import PersistentCourseGrade
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.teams.models import CourseTeamMembership from lms.djangoapps.teams.models import CourseTeamMembership
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache
......
...@@ -20,7 +20,7 @@ from nose.plugins.attrib import attr ...@@ -20,7 +20,7 @@ from nose.plugins.attrib import attr
from capa.responsetypes import StudentInputError from capa.responsetypes import StudentInputError
from capa.tests.response_xml_factory import CodeResponseXMLFactory, CustomResponseXMLFactory from capa.tests.response_xml_factory import CodeResponseXMLFactory, CustomResponseXMLFactory
from courseware.model_data import StudentModule from courseware.model_data import StudentModule
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.instructor_task.api import ( from lms.djangoapps.instructor_task.api import (
submit_delete_problem_state_for_all_students, submit_delete_problem_state_for_all_students,
submit_rescore_problem_for_all_students, submit_rescore_problem_for_all_students,
......
...@@ -135,7 +135,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase): ...@@ -135,7 +135,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
self.assertDictContainsSubset({'attempted': num_students, 'succeeded': num_students, 'failed': 0}, result) self.assertDictContainsSubset({'attempted': num_students, 'succeeded': num_students, 'failed': 0}, result)
@patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task') @patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task')
@patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.iter') @patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.iter')
def test_grading_failure(self, mock_grades_iter, _mock_current_task): def test_grading_failure(self, mock_grades_iter, _mock_current_task):
""" """
Test that any grading errors are properly reported in the Test that any grading errors are properly reported in the
...@@ -312,7 +312,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase): ...@@ -312,7 +312,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
) )
@patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task') @patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task')
@patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.iter') @patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.iter')
def test_unicode_in_csv_header(self, mock_grades_iter, _mock_current_task): def test_unicode_in_csv_header(self, mock_grades_iter, _mock_current_task):
""" """
Tests that CSV grade report works if unicode in headers. Tests that CSV grade report works if unicode in headers.
...@@ -762,7 +762,7 @@ class TestProblemGradeReport(TestReportMixin, InstructorTaskModuleTestCase): ...@@ -762,7 +762,7 @@ class TestProblemGradeReport(TestReportMixin, InstructorTaskModuleTestCase):
]) ])
@patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task') @patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task')
@patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.iter') @patch('lms.djangoapps.grades.course_grade_factory.CourseGradeFactory.iter')
@ddt.data(u'Cannot grade student', '') @ddt.data(u'Cannot grade student', '')
def test_grading_failure(self, error_message, mock_grades_iter, _mock_current_task): def test_grading_failure(self, error_message, mock_grades_iter, _mock_current_task):
""" """
......
...@@ -11,7 +11,7 @@ from opaque_keys.edx.keys import CourseKey ...@@ -11,7 +11,7 @@ from opaque_keys.edx.keys import CourseKey
import lti_provider.outcomes as outcomes import lti_provider.outcomes as outcomes
from lms import CELERY_APP from lms import CELERY_APP
from lms.djangoapps.grades.new.course_grade_factory import CourseGradeFactory from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.grades.signals.signals import PROBLEM_WEIGHTED_SCORE_CHANGED from lms.djangoapps.grades.signals.signals import PROBLEM_WEIGHTED_SCORE_CHANGED
from lti_provider.models import GradedAssignment from lti_provider.models import GradedAssignment
from lti_provider.views import parse_course_and_usage_keys from lti_provider.views import parse_course_and_usage_keys
......
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