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


Python course_grading.CourseGradingModel类代码示例

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


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

示例1: test_fetch_cutoffs

    def test_fetch_cutoffs(self):
        test_grader = CourseGradingModel.fetch_cutoffs(self.course.location)
        # ??? should this check that it's at least a dict? (expected is { "pass" : 0.5 } I think)
        self.assertIsNotNone(test_grader, "No cutoffs via fetch")

        test_grader = CourseGradingModel.fetch_cutoffs(self.course.location.url())
        self.assertIsNotNone(test_grader, "No cutoffs via fetch with url")
开发者ID:AzizYosofi,项目名称:edx-platform,代码行数:7,代码来源:test_course_settings.py

示例2: course_grader_updates

def course_grader_updates(request, org, course, name, grader_index=None):
    """
    Restful CRUD operations on course_info updates. This differs from
    get_course_settings by communicating purely through json (not rendering any
    html) and handles section level operations rather than whole page.

    org, course: Attributes of the Location for the item to edit
    """

    location = get_location_and_verify_access(request, org, course, name)

    if request.method == 'GET':
        # Cannot just do a get w/o knowing the course name :-(
        return JsonResponse(CourseGradingModel.fetch_grader(
                Location(location), grader_index
        ))
    elif request.method == "DELETE":
        # ??? Should this return anything? Perhaps success fail?
        CourseGradingModel.delete_grader(Location(location), grader_index)
        return JsonResponse()
    else:  # post or put, doesn't matter.
        return JsonResponse(CourseGradingModel.update_grader_from_json(
                Location(location),
                request.POST
        ))
开发者ID:NikolayStrekalov,项目名称:edx-platform,代码行数:25,代码来源:course.py

示例3: test_update_from_json

    def test_update_from_json(self):
        test_grader = CourseGradingModel.fetch(self.course_location)
        altered_grader = CourseGradingModel.update_from_json(
            test_grader.__dict__)
        self.assertDictEqual(
            test_grader.__dict__, altered_grader.__dict__, "Noop update")

        test_grader.graders[0][
            'weight'] = test_grader.graders[0].get('weight') * 2
        altered_grader = CourseGradingModel.update_from_json(
            test_grader.__dict__)
        self.assertDictEqual(
            test_grader.__dict__, altered_grader.__dict__, "Weight[0] * 2")

        test_grader.grade_cutoffs['D'] = 0.3
        altered_grader = CourseGradingModel.update_from_json(
            test_grader.__dict__)
        self.assertDictEqual(
            test_grader.__dict__, altered_grader.__dict__, "cutoff add D")

        test_grader.grace_period = {'hours': 4, 'minutes': 5, 'seconds': 0}
        altered_grader = CourseGradingModel.update_from_json(
            test_grader.__dict__)
        print test_grader.grace_period, altered_grader.grace_period
        self.assertDictEqual(
            test_grader.__dict__, altered_grader.__dict__, "4 hour grace period")
开发者ID:hughdbrown,项目名称:edx-platform,代码行数:26,代码来源:test_course_settings.py

示例4: test_fetch_grace

    def test_fetch_grace(self):
        test_grader = CourseGradingModel.fetch_grace_period(self.course.location)
        # almost a worthless test
        self.assertIn('grace_period', test_grader, "No grace via fetch")

        test_grader = CourseGradingModel.fetch_grace_period(self.course.location.url())
        self.assertIn('grace_period', test_grader, "No cutoffs via fetch with url")
开发者ID:AzizYosofi,项目名称:edx-platform,代码行数:7,代码来源:test_course_settings.py

示例5: test_fetch_grader

    def test_fetch_grader(self):
        test_grader = CourseGradingModel.fetch(self.course.id)
        self.assertIsNotNone(test_grader.graders, "No graders")
        self.assertIsNotNone(test_grader.grade_cutoffs, "No cutoffs")

        for i, grader in enumerate(test_grader.graders):
            subgrader = CourseGradingModel.fetch_grader(self.course.id, i)
            self.assertDictEqual(grader, subgrader, str(i) + "th graders not equal")
开发者ID:uestcmooc,项目名称:edx-platform,代码行数:8,代码来源:test_course_settings.py

示例6: remove_entrance_exam_graders

def remove_entrance_exam_graders(course_key, user):
    """
    Removes existing entrance exam graders attached to the specified course
    Typically used when adding/removing an entrance exam.
    """
    grading_model = CourseGradingModel.fetch(course_key)
    graders = grading_model.graders
    for i, grader in enumerate(graders):
        if grader['type'] == GRADER_TYPES['ENTRANCE_EXAM']:
            CourseGradingModel.delete_grader(course_key, i, user)
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:10,代码来源:helpers.py

示例7: test_update_grader_from_json

    def test_update_grader_from_json(self):
        test_grader = CourseGradingModel.fetch(self.course.location)
        altered_grader = CourseGradingModel.update_grader_from_json(test_grader.course_location, test_grader.graders[1])
        self.assertDictEqual(test_grader.graders[1], altered_grader, "Noop update")

        test_grader.graders[1]['min_count'] = test_grader.graders[1].get('min_count') + 2
        altered_grader = CourseGradingModel.update_grader_from_json(test_grader.course_location, test_grader.graders[1])
        self.assertDictEqual(test_grader.graders[1], altered_grader, "min_count[1] + 2")

        test_grader.graders[1]['drop_count'] = test_grader.graders[1].get('drop_count') + 1
        altered_grader = CourseGradingModel.update_grader_from_json(test_grader.course_location, test_grader.graders[1])
        self.assertDictEqual(test_grader.graders[1], altered_grader, "drop_count[1] + 2")
开发者ID:AzizYosofi,项目名称:edx-platform,代码行数:12,代码来源:test_course_settings.py

示例8: test_update_grader_from_json

    def test_update_grader_from_json(self):
        test_grader = CourseGradingModel.fetch(self.course_locator)
        altered_grader = CourseGradingModel.update_grader_from_json(self.course_locator, test_grader.graders[1])
        self.assertDictEqual(test_grader.graders[1], altered_grader, "Noop update")

        test_grader.graders[1]["min_count"] = test_grader.graders[1].get("min_count") + 2
        altered_grader = CourseGradingModel.update_grader_from_json(self.course_locator, test_grader.graders[1])
        self.assertDictEqual(test_grader.graders[1], altered_grader, "min_count[1] + 2")

        test_grader.graders[1]["drop_count"] = test_grader.graders[1].get("drop_count") + 1
        altered_grader = CourseGradingModel.update_grader_from_json(self.course_locator, test_grader.graders[1])
        self.assertDictEqual(test_grader.graders[1], altered_grader, "drop_count[1] + 2")
开发者ID:rsteven7,项目名称:edx-platform,代码行数:12,代码来源:test_course_settings.py

示例9: assignment_type_update

def assignment_type_update(request, org, course, category, name):
    '''
    CRUD operations on assignment types for sections and subsections and anything else gradable.
    '''
    location = Location(['i4x', org, course, category, name])
    if not has_access(request.user, location):
        return HttpResponseForbidden()

    if request.method == 'GET':
        return JsonResponse(CourseGradingModel.get_section_grader_type(location))
    elif request.method in ('POST', 'PUT'):  # post or put, doesn't matter.
        return JsonResponse(CourseGradingModel.update_section_grader_type(location, request.POST))
开发者ID:mccme,项目名称:edx-platform,代码行数:12,代码来源:component.py

示例10: test_wrong_weight_sums

    def test_wrong_weight_sums(self):
        """Сумма весов в настройках не равна 100"""
        self.graders = CourseGradingModel.fetch(self.course.id).graders
        self.graders[0]['weight'] = 103.
        CourseGradingModel.update_grader_from_json(self.course.id, self.graders[0], self.user)

        self.set_task(n_task=5, type_task="Homework")
        self.set_task(n_task=3, type_task="Lab")
        self.set_task(n_task=1, type_task="Final Exam")
        CV = CourseValid(None, str(self.course_key))
        rep = CV.val_grade()
        self.assertEqual(len(rep.warnings), 1)
开发者ID:zimka,项目名称:course_validator,代码行数:12,代码来源:tests.py

示例11: setUp

    def setUp(self):
        """Устанавливает грейдеры на 3 типа заданий и задает им веса"""
        super(GradingValTest, self).setUp()

        self.graders = CourseGradingModel.fetch(self.course.id).graders
        self.graders[0]['min_count'] = 5
        self.graders[1]['min_count'] = 3
        self.graders[0]['weight'] = 33.
        self.graders[1]['weight'] = 27.
        for g in self.graders:
            CourseGradingModel.update_grader_from_json(self.course.id, g, self.user)
        CourseGradingModel.delete_grader(self.course_key, 2, self.user)
开发者ID:zimka,项目名称:course_validator,代码行数:12,代码来源:tests.py

示例12: test_update_from_json

    def test_update_from_json(self, store):
        self.course = CourseFactory.create(default_store=store)

        test_grader = CourseGradingModel.fetch(self.course.id)
        altered_grader = CourseGradingModel.update_from_json(self.course.id, test_grader.__dict__, self.user)
        self.assertDictEqual(test_grader.__dict__, altered_grader.__dict__, "Noop update")

        test_grader.graders[0]['weight'] = test_grader.graders[0].get('weight') * 2
        altered_grader = CourseGradingModel.update_from_json(self.course.id, test_grader.__dict__, self.user)
        self.assertDictEqual(test_grader.__dict__, altered_grader.__dict__, "Weight[0] * 2")

        # test for bug LMS-11485
        with modulestore().bulk_operations(self.course.id):
            new_grader = test_grader.graders[0].copy()
            new_grader['type'] += '_foo'
            new_grader['short_label'] += '_foo'
            new_grader['id'] = len(test_grader.graders)
            test_grader.graders.append(new_grader)
            # don't use altered cached def, get a fresh one
            CourseGradingModel.update_from_json(self.course.id, test_grader.__dict__, self.user)
            altered_grader = CourseGradingModel.fetch(self.course.id)
            self.assertDictEqual(test_grader.__dict__, altered_grader.__dict__)

        test_grader.grade_cutoffs['D'] = 0.3
        altered_grader = CourseGradingModel.update_from_json(self.course.id, test_grader.__dict__, self.user)
        self.assertDictEqual(test_grader.__dict__, altered_grader.__dict__, "cutoff add D")

        test_grader.grace_period = {'hours': 4, 'minutes': 5, 'seconds': 0}
        altered_grader = CourseGradingModel.update_from_json(self.course.id, test_grader.__dict__, self.user)
        self.assertDictEqual(test_grader.__dict__, altered_grader.__dict__, "4 hour grace period")
开发者ID:uestcmooc,项目名称:edx-platform,代码行数:30,代码来源:test_course_settings.py

示例13: assignment_type_update

def assignment_type_update(request, org, course, category, name):
    """
    CRUD operations on assignment types for sections and subsections and
    anything else gradable.
    """
    location = Location(["i4x", org, course, category, name])
    if not has_access(request.user, location):
        return HttpResponseForbidden()

    if request.method == "GET":
        rsp = CourseGradingModel.get_section_grader_type(location)
    elif request.method in ("POST", "PUT"):  # post or put, doesn't matter.
        rsp = CourseGradingModel.update_section_grader_type(location, request.POST)
    return JsonResponse(rsp)
开发者ID:nealmcb,项目名称:edx-platform,代码行数:14,代码来源:component.py

示例14: edit_subsection

def edit_subsection(request, location):
    # check that we have permissions to edit this item
    course = get_course_for_item(location)
    if not has_access(request.user, course.location):
        raise PermissionDenied()

    item = modulestore().get_item(location, depth=1)

    lms_link = get_lms_link_for_item(
        location, course_id=course.location.course_id)
    preview_link = get_lms_link_for_item(
        location, course_id=course.location.course_id, preview=True)

    # make sure that location references a 'sequential', otherwise return
    # BadRequest
    if item.location.category != 'sequential':
        return HttpResponseBadRequest()

    parent_locs = modulestore().get_parent_locations(location, None)

    # we're for now assuming a single parent
    if len(parent_locs) != 1:
        logging.error(
            'Multiple (or none) parents have been found for {0}'.format(location))

    # this should blow up if we don't find any parents, which would be
    # erroneous
    parent = modulestore().get_item(parent_locs[0])

    # remove all metadata from the generic dictionary that is presented in a
    # more normalized UI

    policy_metadata = dict(
        (field.name, field.read_from(item))
        for field
        in item.fields
        if field.name not in ['display_name', 'start', 'due', 'format'] and field.scope == Scope.settings
    )

    can_view_live = False
    subsection_units = item.get_children()
    for unit in subsection_units:
        state = compute_unit_state(unit)
        if state == UnitState.public or state == UnitState.draft:
            can_view_live = True
            break

    return render_to_response('edit_subsection.html',
                              {'subsection': item,
                               'context_course': course,
                               'create_new_unit_template': Location('i4x', 'edx', 'templates', 'vertical', 'Empty'),
                               'lms_link': lms_link,
                               'preview_link': preview_link,
                               'course_graders': json.dumps(CourseGradingModel.fetch(course.location).graders),
                               'parent_location': course.location,
                               'parent_item': parent,
                               'policy_metadata': policy_metadata,
                               'subsection_units': subsection_units,
                               'can_view_live': can_view_live
                               })
开发者ID:hughdbrown,项目名称:edx-platform,代码行数:60,代码来源:component.py

示例15: course_index

def course_index(request, course_key):
    """
    Display an editable course overview.

    org, course, name: Attributes of the Location for the item to edit
    """
    course_module = _get_course_module(course_key, request.user, depth=3)
    lms_link = get_lms_link_for_item(course_module.location)
    sections = course_module.get_children()

    try:
        current_action = CourseRerunState.objects.find_first(course_key=course_key, should_display=True)
    except (ItemNotFoundError, CourseActionStateItemNotFoundError):
        current_action = None

    return render_to_response('overview.html', {
        'context_course': course_module,
        'lms_link': lms_link,
        'sections': sections,
        'course_graders': json.dumps(
            CourseGradingModel.fetch(course_key).graders
        ),
        'new_section_category': 'chapter',
        'new_subsection_category': 'sequential',
        'new_unit_category': 'vertical',
        'category': 'vertical',
        'rerun_notification_id': current_action.id if current_action else None,
    })
开发者ID:TangXT,项目名称:edx-platform,代码行数:28,代码来源:course.py


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