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


Python CreditCourse.is_credit_course方法代码示例

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


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

示例1: update_course_requirements

# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import is_credit_course [as 别名]
def update_course_requirements(course_id):
    """ Updates course requirements table for a course.

     Args:
        course_id(str): A string representation of course identifier

    Returns:
        None
    """
    try:
        course_key = CourseKey.from_string(course_id)
        is_credit_course = CreditCourse.is_credit_course(course_key)
        if is_credit_course:
            course = modulestore().get_course(course_key)
            requirements = [
                {
                    "namespace": "grade",
                    "name": "grade",
                    "criteria": {
                        "min_grade": get_min_grade_for_credit(course)
                    }
                }
            ]
            set_credit_requirements(course_key, requirements)
    except (InvalidKeyError, ItemNotFoundError, InvalidCreditRequirements) as exc:
        LOGGER.error('Error on adding the requirements for course %s - %s', course_id, unicode(exc))
        raise update_course_requirements.retry(args=[course_id], exc=exc)
    else:
        LOGGER.info('Requirements added for course %s', course_id)
开发者ID:ISCLC,项目名称:edx-platform-for-isc,代码行数:31,代码来源:tasks.py

示例2: is_credit_course

# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import is_credit_course [as 别名]
def is_credit_course(course_key):
    """
    Check whether the course has been configured for credit.

    Args:
        course_key (CourseKey): Identifier of the course.

    Returns:
        bool: True iff this is a credit course.

    """
    return CreditCourse.is_credit_course(course_key=course_key)
开发者ID:28554010,项目名称:edx-platform,代码行数:14,代码来源:eligibility.py

示例3: update_credit_course_requirements

# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import is_credit_course [as 别名]
def update_credit_course_requirements(course_id):
    """
    Updates course requirements table for a course.

     Args:
        course_id(str): A string representation of course identifier

    Returns:
        None

    """
    try:
        course_key = CourseKey.from_string(course_id)
        is_credit_course = CreditCourse.is_credit_course(course_key)
        if is_credit_course:
            requirements = _get_course_credit_requirements(course_key)
            set_credit_requirements(course_key, requirements)
    except (InvalidKeyError, ItemNotFoundError, InvalidCreditRequirements) as exc:
        LOGGER.error(u'Error on adding the requirements for course %s - %s', course_id, six.text_type(exc))
        raise update_credit_course_requirements.retry(args=[course_id], exc=exc)
    else:
        LOGGER.info(u'Requirements added for course %s', course_id)
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:24,代码来源:tasks.py

示例4: update_credit_course_requirements

# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import is_credit_course [as 别名]
def update_credit_course_requirements(course_id):  # pylint: disable=invalid-name
    """Updates course requirements table for a course.

     Args:
        course_id(str): A string representation of course identifier

    Returns:
        None

    """
    try:
        course_key = CourseKey.from_string(course_id)
        is_credit_course = CreditCourse.is_credit_course(course_key)
        if is_credit_course:
            course = modulestore().get_course(course_key)
            requirements = _get_course_credit_requirements(course)
            set_credit_requirements(course_key, requirements)
    except (InvalidKeyError, ItemNotFoundError, InvalidCreditRequirements) as exc:
        LOGGER.error("Error on adding the requirements for course %s - %s", course_id, unicode(exc))
        raise update_credit_course_requirements.retry(args=[course_id], exc=exc)
    else:
        LOGGER.info("Requirements added for course %s", course_id)
开发者ID:ramakpuppala,项目名称:edx-platform,代码行数:24,代码来源:tasks.py

示例5: test_is_credit_course

# 需要导入模块: from openedx.core.djangoapps.credit.models import CreditCourse [as 别名]
# 或者: from openedx.core.djangoapps.credit.models.CreditCourse import is_credit_course [as 别名]
 def test_is_credit_course(self, is_credit):
     CreditCourse(course_key=self.course_key, enabled=is_credit).save()
     if is_credit:
         self.assertTrue(CreditCourse.is_credit_course(self.course_key))
     else:
         self.assertFalse(CreditCourse.is_credit_course(self.course_key))
开发者ID:ahmadiga,项目名称:min_edx,代码行数:8,代码来源:test_models.py


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