當前位置: 首頁>>代碼示例>>Python>>正文


Python ReviewUtils.has_completed_all_assigned_reviews方法代碼示例

本文整理匯總了Python中models.review.ReviewUtils.has_completed_all_assigned_reviews方法的典型用法代碼示例。如果您正苦於以下問題:Python ReviewUtils.has_completed_all_assigned_reviews方法的具體用法?Python ReviewUtils.has_completed_all_assigned_reviews怎麽用?Python ReviewUtils.has_completed_all_assigned_reviews使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.review.ReviewUtils的用法示例。


在下文中一共展示了ReviewUtils.has_completed_all_assigned_reviews方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: post

# 需要導入模塊: from models.review import ReviewUtils [as 別名]
# 或者: from models.review.ReviewUtils import has_completed_all_assigned_reviews [as 別名]
    def post(self):
        """Allows a reviewer to request a new review."""
        student = self.personalize_page_and_get_enrolled()
        if not student:
            return

        if not self.assert_xsrf_token_or_fail(self.request, "review-dashboard-post"):
            return

        course = self.get_course()
        unit, unused_lesson = extract_unit_and_lesson(self)
        if not unit:
            self.error(404)
            return

        rp = course.get_reviews_processor()
        review_steps = rp.get_review_steps_by(unit.unit_id, student.get_key())
        self.template_value["navbar"] = {"course": True}

        if not course.needs_human_grader(unit):
            self.error(404)
            return

        # Check that the student has submitted the corresponding assignment.
        if not rp.does_submission_exist(unit.unit_id, student.get_key()):
            self.template_value["error_code"] = "cannot_review_before_submitting_assignment"
            self.render("error.html")
            return

        # Check that the review due date has not passed.
        time_now = datetime.datetime.now()
        review_due_date = unit.workflow.get_review_due_date()
        if time_now > review_due_date:
            self.template_value["error_code"] = "cannot_request_review_after_deadline"
            self.render("error.html")
            return

        # Check that the student can request a new review.
        review_min_count = unit.workflow.get_review_min_count()
        can_request_new_review = len(review_steps) < review_min_count or ReviewUtils.has_completed_all_assigned_reviews(
            review_steps
        )
        if not can_request_new_review:
            self.template_value["review_min_count"] = review_min_count
            self.template_value["error_code"] = "must_complete_more_reviews"
            self.render("error.html")
            return

        self.template_value["no_submissions_available"] = True

        try:
            review_step_key = rp.get_new_review(unit.unit_id, student.get_key())
            redirect_params = {"key": review_step_key, "unit": unit.unit_id}
            self.redirect("/review?%s" % urllib.urlencode(redirect_params))
        except Exception:  # pylint: disable-msg=broad-except
            review_steps = rp.get_review_steps_by(unit.unit_id, student.get_key())
            self.populate_template(unit, review_steps)
            self.render("review_dashboard.html")
開發者ID:johnfelipe,項目名稱:cb-energietransitie,代碼行數:60,代碼來源:lessons.py

示例2: get

# 需要導入模塊: from models.review import ReviewUtils [as 別名]
# 或者: from models.review.ReviewUtils import has_completed_all_assigned_reviews [as 別名]
    def get(self):
        """Handles GET requests."""
        student = self.personalize_page_and_get_enrolled()
        if not student:
            return

        course = self.get_course()
        rp = course.get_reviews_processor()
        unit, _ = extract_unit_and_lesson(self)
        if not unit:
            self.error(404)
            return

        self.template_value['navbar'] = {'course': True}

        if not course.needs_human_grader(unit):
            self.error(404)
            return

        # CGL-MOOC-Builder starts:
        # Set template value for students progress bar that shows on the top navigation(header.html)
        total_progress = (self.get_progress_tracker().get_overall_progress_score(student))
        self.template_value['progress_value'] = total_progress.get('progress_score', 0)
        self.template_value['complete_value'] = total_progress.get('completed_score', 0)
        self.template_value['percentage'] = total_progress.get('percentage', '')
        # CGL-MOOC-Builder ends

        # Check that the student has submitted the corresponding assignment.
        if not rp.does_submission_exist(unit.unit_id, student.get_key()):
            self.template_value['error_code'] = (
                'cannot_review_before_submitting_assignment')
            self.render('error.html')
            return

        review_steps = rp.get_review_steps_by(unit.unit_id, student.get_key())

        self.populate_template(unit, review_steps)
        required_review_count = unit.workflow.get_review_min_count()

        # The student can request a new submission if:
        # - all his/her current reviews are in Draft/Completed state, and
        # - he/she is not in the state where the required number of reviews
        #       has already been requested, but not all of these are completed.
        self.template_value['can_request_new_review'] = (
            len(review_steps) < required_review_count or
            ReviewUtils.has_completed_all_assigned_reviews(review_steps)
        )
        self.render('review_dashboard.html')
開發者ID:cglmoocs,項目名稱:cgl-mooc-builder,代碼行數:50,代碼來源:lessons.py

示例3: get

# 需要導入模塊: from models.review import ReviewUtils [as 別名]
# 或者: from models.review.ReviewUtils import has_completed_all_assigned_reviews [as 別名]
    def get(self):
        """Handles GET requests."""
        student = self.personalize_page_and_get_enrolled()
        if not student:
            return

        course = self.get_course()
        rp = course.get_reviews_processor()
        unit, _ = extract_unit_and_lesson(self)
        if not unit:
            self.error(404)
            return

        self.template_value["navbar"] = {"course": True}

        if not course.needs_human_grader(unit):
            self.error(404)
            return

        # Check that the student has submitted the corresponding assignment.
        if not rp.does_submission_exist(unit.unit_id, student.get_key()):
            self.template_value["error_code"] = "cannot_review_before_submitting_assignment"
            self.render("error.html")
            return

        review_steps = rp.get_review_steps_by(unit.unit_id, student.get_key())

        self.populate_template(unit, review_steps)
        required_review_count = unit.workflow.get_review_min_count()

        # The student can request a new submission if:
        # - all his/her current reviews are in Draft/Completed state, and
        # - he/she is not in the state where the required number of reviews
        #       has already been requested, but not all of these are completed.
        self.template_value["can_request_new_review"] = len(
            review_steps
        ) < required_review_count or ReviewUtils.has_completed_all_assigned_reviews(review_steps)
        self.render("review_dashboard.html")
開發者ID:johnfelipe,項目名稱:cb-energietransitie,代碼行數:40,代碼來源:lessons.py

示例4: post

# 需要導入模塊: from models.review import ReviewUtils [as 別名]
# 或者: from models.review.ReviewUtils import has_completed_all_assigned_reviews [as 別名]
    def post(self):
        """Allows a reviewer to request a new review."""
        student = self.personalize_page_and_get_enrolled()
        if not student:
            return

        if not self.assert_xsrf_token_or_fail(
                self.request, 'review-dashboard-post'):
            return

        # CGL-MOOC-Builder starts:
        # Set template value for students progress bar that shows on the top navigation(header.html)
        total_progress = (self.get_progress_tracker().get_overall_progress_score(student))
        self.template_value['progress_value'] = total_progress.get('progress_score', 0)
        self.template_value['complete_value'] = total_progress.get('completed_score', 0)
        self.template_value['percentage'] = total_progress.get('percentage', '')
        # CGL-MOOC-Builder ends

        course = self.get_course()
        unit, unused_lesson = extract_unit_and_lesson(self)
        if not unit:
            self.error(404)
            return

        rp = course.get_reviews_processor()
        review_steps = rp.get_review_steps_by(unit.unit_id, student.get_key())
        self.template_value['navbar'] = {'course': True}

        if not course.needs_human_grader(unit):
            self.error(404)
            return

        # Check that the student has submitted the corresponding assignment.
        if not rp.does_submission_exist(unit.unit_id, student.get_key()):
            self.template_value['error_code'] = (
                'cannot_review_before_submitting_assignment')
            self.render('error.html')
            return

        # Check that the review due date has not passed.
        time_now = datetime.datetime.now()
        review_due_date = unit.workflow.get_review_due_date()
        if time_now > review_due_date:
            self.template_value['error_code'] = (
                'cannot_request_review_after_deadline')
            self.render('error.html')
            return

        # Check that the student can request a new review.
        review_min_count = unit.workflow.get_review_min_count()
        can_request_new_review = (
            len(review_steps) < review_min_count or
            ReviewUtils.has_completed_all_assigned_reviews(review_steps))
        if not can_request_new_review:
            self.template_value['review_min_count'] = review_min_count
            self.template_value['error_code'] = 'must_complete_more_reviews'
            self.render('error.html')
            return

        self.template_value['no_submissions_available'] = True

        try:
            review_step_key = rp.get_new_review(unit.unit_id, student.get_key())
            redirect_params = {
                'key': review_step_key,
                'unit': unit.unit_id,
            }
            self.redirect('/review?%s' % urllib.urlencode(redirect_params))
        except Exception:  # pylint: disable-msg=broad-except
            review_steps = rp.get_review_steps_by(
                unit.unit_id, student.get_key())
            self.populate_template(unit, review_steps)
            self.render('review_dashboard.html')
開發者ID:cglmoocs,項目名稱:cgl-mooc-builder,代碼行數:75,代碼來源:lessons.py


注:本文中的models.review.ReviewUtils.has_completed_all_assigned_reviews方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。