Example #1
0
 def _add_entrance_exam_to_context(self, courseware_context):
     """
     Adds entrance exam related information to the given context.
     """
     if course_has_entrance_exam(self.course) and getattr(self.chapter, 'is_entrance_exam', False):
         courseware_context['entrance_exam_passed'] = user_has_passed_entrance_exam(self.effective_user, self.course)
         courseware_context['entrance_exam_current_score'] = get_entrance_exam_score_ratio(
             CourseGradeFactory().read(self.effective_user, self.course),
             get_entrance_exam_usage_key(self.course),
         )
Example #2
0
 def _add_entrance_exam_to_context(self, courseware_context):
     """
     Adds entrance exam related information to the given context.
     """
     if course_has_entrance_exam(self.course) and getattr(self.chapter, 'is_entrance_exam', False):
         courseware_context['entrance_exam_passed'] = user_has_passed_entrance_exam(self.effective_user, self.course)
         courseware_context['entrance_exam_current_score'] = get_entrance_exam_score_ratio(
             CourseGradeFactory().read(self.effective_user, self.course),
             get_entrance_exam_usage_key(self.course),
         )
Example #3
0
    def entrance_exam_data(self):
        """
        Returns Entrance Exam data for the course

        Although some of the fields will have values (i.e. entrance_exam_minimum_score_pct and
        entrance_exam_passed), nothing will be used unless entrance_exam_enabled is True.
        """
        return {
            'entrance_exam_current_score': get_entrance_exam_score(
                self.course_grade, get_entrance_exam_usage_key(self.overview),
            ),
            'entrance_exam_enabled': course_has_entrance_exam(self.overview),
            'entrance_exam_id': self.overview.entrance_exam_id,
            'entrance_exam_minimum_score_pct': self.overview.entrance_exam_minimum_score_pct,
            'entrance_exam_passed': user_has_passed_entrance_exam(self.effective_user, self.overview),
        }