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


Python student_work.StudentWorkUtils类代码示例

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


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

示例1: configure_active_view_1_4

 def configure_active_view_1_4(self, unit, submission_contents):
     self.template_value['assessment_script_src'] = (
         self.get_course().get_assessment_filename(unit.unit_id))
     if submission_contents:
         # If a previous submission exists, reinstate it.
         self.template_value['saved_answers'] = transforms.dumps(
             StudentWorkUtils.get_answer_list(submission_contents))
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:7,代码来源:lessons.py

示例2: configure_active_review_1_4

 def configure_active_review_1_4(self, unit, review_contents):
     self.template_value['assessment_script_src'] = (
         self.get_course().get_review_form_filename(unit.unit_id))
     saved_answers = (
         StudentWorkUtils.get_answer_list(review_contents)
         if review_contents else [])
     self.template_value['saved_answers'] = transforms.dumps(saved_answers)
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:7,代码来源:lessons.py

示例3: get

    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, unused_lesson = extract_unit_and_lesson(self)

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

        review_step_key = self.request.get('key')
        if not unit or not review_step_key:
            self.error(404)
            return

        try:
            review_step_key = db.Key(encoded=review_step_key)
            review_step = rp.get_review_steps_by_keys(
                unit.unit_id, [review_step_key])[0]
        except Exception:  # pylint: disable-msg=broad-except
            self.error(404)
            return

        if not review_step:
            self.error(404)
            return

        # Check that the student is allowed to review this submission.
        if not student.has_same_key_as(review_step.reviewer_key):
            self.error(404)
            return

        self.template_value['navbar'] = {'course': True}
        self.template_value['unit_id'] = unit.unit_id
        self.template_value['key'] = review_step_key

        submission_key = review_step.submission_key
        submission_contents = student_work.Submission.get_contents_by_key(
            submission_key)

        readonly_student_assessment = create_readonly_assessment_params(
            course.get_assessment_content(unit),
            StudentWorkUtils.get_answer_list(submission_contents)
        )
        self.template_value['readonly_student_assessment'] = (
            readonly_student_assessment
        )

        review_due_date = unit.workflow.get_review_due_date()
        if review_due_date:
            self.template_value['review_due_date'] = review_due_date.strftime(
                HUMAN_READABLE_DATETIME_FORMAT)

        review_key = review_step.review_key
        rev = rp.get_reviews_by_keys(
            unit.unit_id, [review_key])[0] if review_key else None

        time_now = datetime.datetime.now()
        show_readonly_review = (
            review_step.state == domain.REVIEW_STATE_COMPLETED or
            time_now > review_due_date)

        self.template_value['due_date_exceeded'] = (time_now > review_due_date)

        if show_readonly_review:
            readonly_review_form = create_readonly_assessment_params(
                course.get_review_form_content(unit),
                StudentWorkUtils.get_answer_list(rev)
            )
            self.template_value['readonly_review_form'] = readonly_review_form
        else:
            # Populate the review form,
            self.template_value['assessment_script_src'] = (
                self.get_course().get_review_form_filename(unit.unit_id))
            saved_answers = (StudentWorkUtils.get_answer_list(rev)
                             if rev else [])
            self.template_value['saved_answers'] = transforms.dumps(
                saved_answers)

        self.template_value['record_events'] = CAN_PERSIST_ACTIVITY_EVENTS.value
        self.template_value['assessment_xsrf_token'] = (
            XsrfTokenManager.create_xsrf_token('review-post'))
        self.template_value['event_xsrf_token'] = (
            XsrfTokenManager.create_xsrf_token('event-post'))

        self.render('review.html')
开发者ID:graemian,项目名称:ami-mooc-pilot,代码行数:90,代码来源:lessons.py

示例4: configure_assessment_view_1_4

 def configure_assessment_view_1_4(self, unit, submission_contents):
     readonly_student_assessment = create_readonly_assessment_params(
         self.get_course().get_assessment_content(unit),
         StudentWorkUtils.get_answer_list(submission_contents))
     self.template_value[
         'readonly_student_assessment'] = readonly_student_assessment
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:6,代码来源:lessons.py

示例5: get_review_received_1_4

 def get_review_received_1_4(self, unit, review):
     return create_readonly_assessment_params(
         self.get_course().get_review_form_content(unit),
         StudentWorkUtils.get_answer_list(review))
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:4,代码来源:lessons.py

示例6: configure_readonly_review_1_4

 def configure_readonly_review_1_4(self, unit, review_contents):
     readonly_review_form = create_readonly_assessment_params(
         self.get_course().get_review_form_content(unit),
         StudentWorkUtils.get_answer_list(review_contents))
     self.template_value['readonly_review_form'] = readonly_review_form
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:5,代码来源:lessons.py

示例7: get_start

    def get_start(self):
        """Handles GET requests."""
        student = self.personalize_page_and_get_enrolled()
        if not student:
            return
        if not self.assert_participant_or_fail(student):
            return

        # Extract incoming args
        unit_id = self.request.get("name")
        course = self.get_course()
        unit = course.find_unit_by_id(unit_id)
        if not unit:
            self.error(404)
            return

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

        try:
            AssessmentTracker.try_start_test(student, unit_id)
        except ValueError as e:
            self.template_value["error"] = e.message
            self.render("assessment_denied.html")
            return

        self.template_value["unit_id"] = unit_id
        self.template_value["record_events"] = CAN_PERSIST_ACTIVITY_EVENTS.value
        self.template_value["assessment_xsrf_token"] = XsrfTokenManager.create_xsrf_token("assessment-post")
        self.template_value["event_xsrf_token"] = XsrfTokenManager.create_xsrf_token("event-post")

        self.template_value["grader"] = unit.workflow.get_grader()

        readonly_view = False
        due_date_exceeded = False

        submission_due_date = unit.workflow.get_submission_due_date()
        if submission_due_date:
            self.template_value["submission_due_date"] = submission_due_date.strftime(HUMAN_READABLE_DATETIME_FORMAT)

            time_now = datetime.datetime.now()
            if time_now > submission_due_date:
                readonly_view = True
                due_date_exceeded = True
                self.template_value["due_date_exceeded"] = True

        if course.needs_human_grader(unit):
            self.template_value["matcher"] = unit.workflow.get_matcher()

            rp = course.get_reviews_processor()
            review_steps_by = rp.get_review_steps_by(unit.unit_id, student.get_key())

            # Determine if the student can see others' reviews of his/her work.
            if ReviewUtils.has_completed_enough_reviews(review_steps_by, unit.workflow.get_review_min_count()):
                submission_and_review_steps = rp.get_submission_and_review_steps(unit.unit_id, student.get_key())

                submission_contents = submission_and_review_steps[0]
                review_steps_for = submission_and_review_steps[1]

                review_keys_for_student = []
                for review_step in review_steps_for:
                    can_show_review = (
                        review_step.state == domain.REVIEW_STATE_COMPLETED
                        and not review_step.removed
                        and review_step.review_key
                    )

                    if can_show_review:
                        review_keys_for_student.append(review_step.review_key)

                reviews_for_student = rp.get_reviews_by_keys(unit.unit_id, review_keys_for_student)

                self.template_value["reviews_received"] = [
                    create_readonly_assessment_params(
                        course.get_review_form_content(unit), StudentWorkUtils.get_answer_list(review)
                    )
                    for review in reviews_for_student
                ]
            else:
                submission_contents = student_work.Submission.get_contents(unit.unit_id, student.get_key())

            # Determine whether to show the assessment in readonly mode.
            if submission_contents or due_date_exceeded:
                readonly_view = True
                self.template_value["readonly_student_assessment"] = create_readonly_assessment_params(
                    course.get_assessment_content(unit), StudentWorkUtils.get_answer_list(submission_contents)
                )

        if not readonly_view:
            self.template_value["assessment_script_src"] = self.get_course().get_assessment_filename(unit_id)

            # If a previous submission exists, reinstate it.
            submission_contents = student_work.Submission.get_contents(unit.unit_id, student.get_key())
            saved_answers = StudentWorkUtils.get_answer_list(submission_contents) if submission_contents else []
            self.template_value["saved_answers"] = transforms.dumps(saved_answers)

        self.render("assessment.html")
开发者ID:twiffy,项目名称:eabooc,代码行数:96,代码来源:lessons.py


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