当前位置: 首页>>代码示例>>Python>>正文


Python models.PersistentCourseGrade类代码示例

本文整理汇总了Python中lms.djangoapps.grades.models.PersistentCourseGrade的典型用法代码示例。如果您正苦于以下问题:Python PersistentCourseGrade类的具体用法?Python PersistentCourseGrade怎么用?Python PersistentCourseGrade使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PersistentCourseGrade类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_update

 def test_update(self):
     created_grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
     self.params["percent_grade"] = 88.8
     self.params["letter_grade"] = "Better job"
     updated_grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
     self.assertEqual(updated_grade.percent_grade, 88.8)
     self.assertEqual(updated_grade.letter_grade, "Better job")
     self.assertEqual(created_grade.id, updated_grade.id)
开发者ID:CUCWD,项目名称:edx-platform,代码行数:8,代码来源:test_models.py

示例2: __init__

 def __init__(self, context, users):
     self.certs = _CertificateBulkContext(context, users)
     self.teams = _TeamBulkContext(context, users)
     self.enrollments = _EnrollmentBulkContext(context, users)
     bulk_cache_cohorts(context.course_id, users)
     BulkRoleCache.prefetch(users)
     PersistentCourseGrade.prefetch(context.course_id, users)
     BulkCourseTags.prefetch(context.course_id, users)
开发者ID:cmscom,项目名称:edx-platform,代码行数:8,代码来源:grades.py

示例3: test_create_and_read_grade

 def test_create_and_read_grade(self):
     created_grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
     read_grade = PersistentCourseGrade.read_course_grade(self.params["user_id"], self.params["course_id"])
     for param in self.params:
         if param == u'passed':
             continue  # passed/passed_timestamp takes special handling, and is tested separately
         self.assertEqual(self.params[param], getattr(created_grade, param))
     self.assertIsInstance(created_grade.passed_timestamp, datetime)
     self.assertEqual(created_grade, read_grade)
开发者ID:CUCWD,项目名称:edx-platform,代码行数:9,代码来源:test_models.py

示例4: bulk_course_grade_context

def bulk_course_grade_context(course_key, users):
    """
    Prefetches grades for the given users in the given course
    within a context, storing in a RequestCache and deleting
    on context exit.
    """
    PersistentCourseGrade.prefetch(course_key, users)
    yield
    PersistentCourseGrade.clear_prefetched_data(course_key)
开发者ID:mitocw,项目名称:edx-platform,代码行数:9,代码来源:views.py

示例5: test_persistent_grades_not_enabled_on_course

 def test_persistent_grades_not_enabled_on_course(self, default_store, num_mongo_queries, num_sql_queries):
     with self.store.default_store(default_store):
         self.set_up_course(enable_persistent_grades=False)
         with check_mongo_calls(num_mongo_queries):
             with self.assertNumQueries(num_sql_queries):
                 self._apply_recalculate_subsection_grade()
         with self.assertRaises(PersistentCourseGrade.DoesNotExist):
             PersistentCourseGrade.read(self.user.id, self.course.id)
         self.assertEqual(len(PersistentSubsectionGrade.bulk_read_grades(self.user.id, self.course.id)), 0)
开发者ID:dehamzah,项目名称:edx-platform,代码行数:9,代码来源:test_tasks.py

示例6: bulk_gradebook_view_context

def bulk_gradebook_view_context(course_key, users):
    """
    Prefetches all course and subsection grades in the given course for the given
    list of users, also, fetch all the score relavant data,
    storing the result in a RequestCache and deleting grades on context exit.
    """
    PersistentSubsectionGrade.prefetch(course_key, users)
    PersistentCourseGrade.prefetch(course_key, users)
    CourseEnrollment.bulk_fetch_enrollment_states(users, course_key)
    cohorts.bulk_cache_cohorts(course_key, users)
    BulkRoleCache.prefetch(users)
    yield
    PersistentSubsectionGrade.clear_prefetched_data(course_key)
    PersistentCourseGrade.clear_prefetched_data(course_key)
开发者ID:mitocw,项目名称:edx-platform,代码行数:14,代码来源:views.py

示例7: test_persistent_grades_enabled_on_course

 def test_persistent_grades_enabled_on_course(self, default_store, num_mongo_queries, num_sql_queries):
     with self.store.default_store(default_store):
         self.set_up_course(enable_persistent_grades=True)
         with check_mongo_calls(num_mongo_queries):
             with self.assertNumQueries(num_sql_queries):
                 self._apply_recalculate_subsection_grade()
         self.assertIsNotNone(PersistentCourseGrade.read(self.user.id, self.course.id))
         self.assertGreater(len(PersistentSubsectionGrade.bulk_read_grades(self.user.id, self.course.id)), 0)
开发者ID:dehamzah,项目名称:edx-platform,代码行数:8,代码来源:test_tasks.py

示例8: test_passed_timestamp

    def test_passed_timestamp(self):
        # When the user has not passed, passed_timestamp is None
        self.params.update({
            u'percent_grade': 25.0,
            u'letter_grade': u'',
            u'passed': False,
        })
        grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
        self.assertIsNone(grade.passed_timestamp)

        # After the user earns a passing grade, the passed_timestamp is set
        self.params.update({
            u'percent_grade': 75.0,
            u'letter_grade': u'C',
            u'passed': True,
        })
        grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
        passed_timestamp = grade.passed_timestamp
        self.assertEqual(grade.letter_grade, u'C')
        self.assertIsInstance(passed_timestamp, datetime)

        # After the user improves their score, the new grade is reflected, but
        # the passed_timestamp remains the same.
        self.params.update({
            u'percent_grade': 95.0,
            u'letter_grade': u'A',
            u'passed': True,
        })
        grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
        self.assertEqual(grade.letter_grade, u'A')
        self.assertEqual(grade.passed_timestamp, passed_timestamp)

        # If the grade later reverts to a failing grade, they keep their passed_timestamp
        self.params.update({
            u'percent_grade': 20.0,
            u'letter_grade': u'',
            u'passed': False,
        })
        grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
        self.assertEqual(grade.letter_grade, u'')
        self.assertEqual(grade.passed_timestamp, passed_timestamp)
开发者ID:CUCWD,项目名称:edx-platform,代码行数:41,代码来源:test_models.py

示例9: test_create_and_read_grade

 def test_create_and_read_grade(self):
     created_grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
     read_grade = PersistentCourseGrade.read_course_grade(self.params["user_id"], self.params["course_id"])
     for param in self.params:
         self.assertEqual(self.params[param], getattr(created_grade, param))
     self.assertEqual(created_grade, read_grade)
开发者ID:chrisndodge,项目名称:edx-platform,代码行数:6,代码来源:test_models.py

示例10: clear_prefetched_course_and_subsection_grades

def clear_prefetched_course_and_subsection_grades(course_key):
    _PersistentCourseGrade.clear_prefetched_data(course_key)
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:2,代码来源:models_api.py

示例11: prefetch_course_and_subsection_grades

def prefetch_course_and_subsection_grades(course_key, users):
    _PersistentCourseGrade.prefetch(course_key, users)
    _PersistentSubsectionGrade.prefetch(course_key, users)
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:3,代码来源:models_api.py

示例12: test_optional_fields

 def test_optional_fields(self, field):
     del self.params[field]
     grade = PersistentCourseGrade.update_or_create(**self.params)
     self.assertFalse(getattr(grade, field))
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:4,代码来源:test_models.py

示例13: test_grade_does_not_exist

 def test_grade_does_not_exist(self):
     with self.assertRaises(PersistentCourseGrade.DoesNotExist):
         PersistentCourseGrade.read_course_grade(self.params["user_id"], self.params["course_id"])
开发者ID:CUCWD,项目名称:edx-platform,代码行数:3,代码来源:test_models.py

示例14: test_update_or_create_with_bad_params

 def test_update_or_create_with_bad_params(self, param, val, error):
     self.params[param] = val
     with self.assertRaises(error):
         PersistentCourseGrade.update_or_create_course_grade(**self.params)
开发者ID:CUCWD,项目名称:edx-platform,代码行数:4,代码来源:test_models.py

示例15: test_passed_timestamp_is_now

 def test_passed_timestamp_is_now(self):
     grade = PersistentCourseGrade.update_or_create_course_grade(**self.params)
     self.assertEqual(now(), grade.passed_timestamp)
开发者ID:CUCWD,项目名称:edx-platform,代码行数:3,代码来源:test_models.py


注:本文中的lms.djangoapps.grades.models.PersistentCourseGrade类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。