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


Python IDVerificationService.verification_status_for_user方法代码示例

本文整理汇总了Python中lms.djangoapps.verify_student.services.IDVerificationService.verification_status_for_user方法的典型用法代码示例。如果您正苦于以下问题:Python IDVerificationService.verification_status_for_user方法的具体用法?Python IDVerificationService.verification_status_for_user怎么用?Python IDVerificationService.verification_status_for_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lms.djangoapps.verify_student.services.IDVerificationService的用法示例。


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

示例1: _user_verification_mode

# 需要导入模块: from lms.djangoapps.verify_student.services import IDVerificationService [as 别名]
# 或者: from lms.djangoapps.verify_student.services.IDVerificationService import verification_status_for_user [as 别名]
 def _user_verification_mode(self, user, context, bulk_enrollments):
     """
     Returns a list of enrollment-mode and verification-status for the
     given user.
     """
     enrollment_mode = CourseEnrollment.enrollment_mode_for_user(user, context.course_id)[0]
     verification_status = IDVerificationService.verification_status_for_user(
         user,
         enrollment_mode,
         user_is_verified=user.id in bulk_enrollments.verified_users,
     )
     return [enrollment_mode, verification_status]
开发者ID:cmscom,项目名称:edx-platform,代码行数:14,代码来源:grades.py

示例2: extract_student

# 需要导入模块: from lms.djangoapps.verify_student.services import IDVerificationService [as 别名]
# 或者: from lms.djangoapps.verify_student.services.IDVerificationService import verification_status_for_user [as 别名]
    def extract_student(student, features):
        """ convert student to dictionary """
        student_features = [x for x in STUDENT_FEATURES if x in features]
        profile_features = [x for x in PROFILE_FEATURES if x in features]

        # For data extractions on the 'meta' field
        # the feature name should be in the format of 'meta.foo' where
        # 'foo' is the keyname in the meta dictionary
        meta_features = []
        for feature in features:
            if 'meta.' in feature:
                meta_key = feature.split('.')[1]
                meta_features.append((feature, meta_key))

        student_dict = dict((feature, extract_attr(student, feature))
                            for feature in student_features)
        profile = student.profile
        if profile is not None:
            profile_dict = dict((feature, extract_attr(profile, feature))
                                for feature in profile_features)
            student_dict.update(profile_dict)

            # now fetch the requested meta fields
            meta_dict = json.loads(profile.meta) if profile.meta else {}
            for meta_feature, meta_key in meta_features:
                student_dict[meta_feature] = meta_dict.get(meta_key)

        if include_cohort_column:
            # Note that we use student.course_groups.all() here instead of
            # student.course_groups.filter(). The latter creates a fresh query,
            # therefore negating the performance gain from prefetch_related().
            student_dict['cohort'] = next(
                (cohort.name for cohort in student.course_groups.all() if cohort.course_id == course_key),
                "[unassigned]"
            )

        if include_team_column:
            student_dict['team'] = next(
                (team.name for team in student.teams.all() if team.course_id == course_key),
                UNAVAILABLE
            )

        if include_enrollment_mode or include_verification_status:
            enrollment_mode = CourseEnrollment.enrollment_mode_for_user(student, course_key)[0]
            if include_verification_status:
                student_dict['verification_status'] = IDVerificationService.verification_status_for_user(
                    student,
                    enrollment_mode
                )
            if include_enrollment_mode:
                student_dict['enrollment_mode'] = enrollment_mode

        return student_dict
开发者ID:jolyonb,项目名称:edx-platform,代码行数:55,代码来源:basic.py

示例3: test_verification_status_for_user

# 需要导入模块: from lms.djangoapps.verify_student.services import IDVerificationService [as 别名]
# 或者: from lms.djangoapps.verify_student.services.IDVerificationService import verification_status_for_user [as 别名]
    def test_verification_status_for_user(self, enrollment_mode, status, output):
        """
        Verify verification_status_for_user returns correct status.
        """
        user = UserFactory.create()
        CourseFactory.create()

        with patch(
            'lms.djangoapps.verify_student.services.IDVerificationService.user_is_verified'
        ) as mock_verification:

            mock_verification.return_value = status

            status = IDVerificationService.verification_status_for_user(user, enrollment_mode)
            self.assertEqual(status, output)
开发者ID:mreyk,项目名称:edx-platform,代码行数:17,代码来源:test_services.py


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