def get_context_data(self, **kwargs):
        self.secondary_nav_items = copy.deepcopy(self.secondary_nav_items_base)
        if switch_is_active('enable_performance_learning_outcome'):
            if not any(d['name'] == 'learning_outcomes'
                       for d in self.secondary_nav_items):
                self.secondary_nav_items.append({
                    'name':
                    'learning_outcomes',
                    'label':
                    _('Learning Outcomes'),
                    'view':
                    'courses:performance:learning_outcomes'
                })

        context_data = super(PerformanceTemplateView,
                             self).get_context_data(**kwargs)
        self.presenter = CoursePerformancePresenter(self.access_token,
                                                    self.course_id)

        context_data['no_data_message'] = self.no_data_message
        context_data['js_data']['course'].update({
            'contentTableHeading':
            _('Assignment Name')  # overwrite for different heading
        })

        return context_data
示例#2
0
 def setUp(self):
     cache.clear()
     self.course_id = PERFORMER_PRESENTER_COURSE_ID
     self.problem_id = 'i4x://edX/DemoX.1/problem/05d289c5ad3d47d48a77622c4a81ec36'
     self.presenter = CoursePerformancePresenter(settings.COURSE_API_KEY,
                                                 self.course_id)
     self.factory = CoursePerformanceDataFactory()
示例#3
0
    def get_context_data(self, **kwargs):
        context_data = super(PerformanceTemplateView,
                             self).get_context_data(**kwargs)
        self.presenter = CoursePerformancePresenter(self.access_token,
                                                    self.course_id)

        context_data['no_data_message'] = self.no_data_message
        context_data['js_data']['course'].update({
            'contentTableHeading':
            _('Assignment Name')  # overwrite for different heading
        })

        return context_data
    def get_context_data(self, **kwargs):
        context = super(PerformanceTemplateView,
                        self).get_context_data(**kwargs)
        self.presenter = CoursePerformancePresenter(self.access_token,
                                                    self.course_id)

        context['assignment_types'] = self.presenter.assignment_types()

        if self.assignment_id:
            assignment = self.presenter.assignment(self.assignment_id)
            if assignment:
                context['assignment'] = assignment
                context['assignment_name'] = assignment['name']
                self.assignment = assignment
                self.assignment_type = assignment['assignment_type']
            else:
                logger.info('Assignment %s not found.', self.assignment_id)
                raise Http404

        if self.assignment_type:
            self._deslugify_assignment_type()
            assignments = self.presenter.assignments(self.assignment_type)

            context['js_data']['course']['assignments'] = assignments
            context['js_data']['course'][
                'assignmentsHaveSubmissions'] = self.presenter.has_submissions(
                    assignments)
            context['js_data']['course'][
                'assignmentType'] = self.assignment_type

            context.update({
                'assignment_type':
                self.assignment_type,
                'assignments':
                assignments,
                'update_message':
                self.get_last_updated_message(self.presenter.last_updated)
            })

        return context
示例#5
0
    def get_context_data(self, **kwargs):
        context = super(PerformanceAnswerDistributionView, self).get_context_data(**kwargs)
        presenter = CoursePerformancePresenter(self.course_id)

        problem_id = self.kwargs['content_id']
        part_id = self.kwargs['problem_part_id']
        view_live_url = None

        if settings.LMS_COURSE_SHORTCUT_BASE_URL:
            view_live_url = '{0}/{1}/jump_to/{2}'.format(settings.LMS_COURSE_SHORTCUT_BASE_URL,
                                                         self.course_id, problem_id)

        try:
            answer_distribution_entry = presenter.get_answer_distribution(problem_id, part_id)
        except NotFoundError:
            logger.error("Failed to retrieve performance answer distribution data for %s.", part_id)
            # if the problem_part_id isn't found, a NotFoundError is thrown and a 404 should be displayed
            raise NotFoundError

        context['js_data']['course'].update({
            'answerDistribution': answer_distribution_entry.answer_distribution,
            'answerDistributionLimited': answer_distribution_entry.answer_distribution_limited,
            'isRandom': answer_distribution_entry.is_random,
            'answerType': answer_distribution_entry.answer_type
        })

        context.update({
            'course_id': self.course_id,
            'questions': answer_distribution_entry.questions,
            'active_question': answer_distribution_entry.active_question,
            'problem_id': problem_id,
            'problem_part_id': part_id,
            'problem_part_description': answer_distribution_entry.problem_part_description,
            'view_live_url': view_live_url,
            'update_message': self.get_last_updated_message(answer_distribution_entry.last_updated)
        })
        context['page_data'] = self.get_page_data(context)

        return context
示例#6
0
 def setUp(self):
     cache.clear()
     self.course_id = 'edX/DemoX/Demo_Course'
     self.problem_id = 'i4x://edX/DemoX.1/problem/05d289c5ad3d47d48a77622c4a81ec36'
     self.presenter = CoursePerformancePresenter(None, self.course_id)
     self.factory = CoursePerformanceDataFactory()
示例#7
0
 def setUp(self):
     self.course_id = 'edX/DemoX/Demo_Course'
     self.problem_id = 'i4x://edX/DemoX.1/problem/05d289c5ad3d47d48a77622c4a81ec36'
     self.presenter = CoursePerformancePresenter(self.course_id)