示例#1
0
文件: csv.py 项目: somanshreddy/edX
 def render_to_response(self, context, **response_kwargs):
     presenter = CourseReportDownloadPresenter(self.course_id)
     data = presenter.get_report_info(
         CourseReportDownloadPresenter.PROBLEM_RESPONSES)
     return HttpResponseRedirect(data['download_url'], **response_kwargs)
示例#2
0
    def get_table_items(self, request):
        items = []

        enrollment_items = {
            'name':
            _('Enrollment'),
            'icon':
            'fa-child',
            'heading':
            _('Who are my learners?'),
            'items': [
                {
                    'title':
                    ugettext_noop('How many learners are in my course?'),
                    'view': 'courses:enrollment:activity',
                    'breadcrumbs': [_('Activity')],
                    'fragment': '',
                    'scope': 'course',
                    'lens': 'enrollment',
                    'report': 'activity',
                    'depth': ''
                },
                {
                    'title': ugettext_noop('How old are my learners?'),
                    'view': 'courses:enrollment:demographics_age',
                    'breadcrumbs': [_('Demographics'),
                                    _('Age')],
                    'fragment': '',
                    'scope': 'course',
                    'lens': 'enrollment',
                    'report': 'demographics',
                    'depth': 'age'
                },
                {
                    'title':
                    ugettext_noop(
                        'What level of education do my learners have?'),
                    'view':
                    'courses:enrollment:demographics_education',
                    'breadcrumbs': [_('Demographics'),
                                    _('Education')],
                    'fragment':
                    '',
                    'scope':
                    'course',
                    'lens':
                    'enrollment',
                    'report':
                    'demographics',
                    'depth':
                    'education'
                },
                {
                    'title':
                    ugettext_noop('What is the learner gender breakdown?'),
                    'view': 'courses:enrollment:demographics_gender',
                    'breadcrumbs': [_('Demographics'),
                                    _('Gender')],
                    'fragment': '',
                    'scope': 'course',
                    'lens': 'enrollment',
                    'report': 'demographics',
                    'depth': 'gender'
                },
                {
                    'title': ugettext_noop('Where are my learners?'),
                    'view': 'courses:enrollment:geography',
                    'breadcrumbs': [_('Geography')],
                    'fragment': '',
                    'scope': 'course',
                    'lens': 'enrollment',
                    'report': 'geography',
                    'depth': ''
                },
            ],
        }
        items.append(enrollment_items)

        engagement_items = {
            'name':
            _('Engagement'),
            'icon':
            'fa-bar-chart',
            'heading':
            _('What are learners doing in my course?'),
            'items': [{
                'title':
                ugettext_noop(
                    'How many learners are interacting with my course?'),
                'view':
                'courses:engagement:content',
                'breadcrumbs': [_('Content')],
                'fragment':
                '',
                'scope':
                'course',
                'lens':
                'engagement',
                'report':
                'content',
                'depth':
                ''
            }]
        }
        if switch_is_active('enable_engagement_videos_pages'):
            engagement_items['items'].append({
                'title':
                ugettext_noop('How did learners interact with course videos?'),
                'view':
                'courses:engagement:videos',
                'breadcrumbs': [_('Videos')],
                'fragment':
                '',
                'scope':
                'course',
                'lens':
                'engagement',
                'report':
                'videos',
                'depth':
                ''
            })

        items.append(engagement_items)

        if self.course_api_enabled:
            subitems = [{
                'title':
                ugettext_noop(
                    'How are learners doing on graded course assignments?'),
                'view':
                'courses:performance:graded_content',
                'breadcrumbs': [_('Graded Content')],
                'fragment':
                '',
                'scope':
                'course',
                'lens':
                'performance',
                'report':
                'graded',
                'depth':
                ''
            }, {
                'title':
                ugettext_noop('How are learners doing on ungraded exercises?'),
                'view':
                'courses:performance:ungraded_content',
                'breadcrumbs': [_('Ungraded Problems')],
                'fragment':
                '',
                'scope':
                'course',
                'lens':
                'performance',
                'report':
                'ungraded',
                'depth':
                ''
            }]

            if switch_is_active('enable_performance_learning_outcome'):
                subitems.append({
                    'title':
                    ugettext_noop(
                        'What is the breakdown for course learning outcomes?'),
                    'view':
                    'courses:performance:learning_outcomes',
                    'breadcrumbs': [_('Learning Outcomes')],
                    'fragment':
                    '',
                    'scope':
                    'course',
                    'lens':
                    'performance',
                    'report':
                    'outcomes',
                    'depth':
                    ''
                })

            if switch_is_active('enable_problem_response_download'):
                try:
                    info = CourseReportDownloadPresenter(
                        self.course_id).get_report_info(
                            report_name=CourseReportDownloadPresenter.
                            PROBLEM_RESPONSES)
                except NotFoundError:
                    info = {}
                if 'download_url' in info:
                    # A problem response report CSV is available:
                    subitems.append({
                        'title':
                        ugettext_noop(
                            'How are learners responding to questions?'),
                        'view':
                        'courses:csv:performance_problem_responses',
                        'breadcrumbs': [_('Problem Response Report')],
                        'format':
                        'csv',
                    })

            items.append({
                'name':
                _('Performance'),
                'icon':
                'fa-check-square-o',
                'heading':
                _('How are learners doing on course assignments?'),
                'items':
                subitems
            })

        if flag_is_active(request, 'display_learner_analytics'):
            items.append({
                'name':
                _('Learners'),
                'icon':
                'fa-users',
                'heading':
                _('What are individual learners doing?'),
                'items': [
                    {
                        'title': ugettext_noop("Who is engaged? Who isn't?"),
                        'view': 'courses:learners:learners',
                        'breadcrumbs': [_('All Learners')],
                        'fragment': '#?ignore_segments=inactive',
                        'scope': 'course',
                        'lens': 'learners',
                        'report': 'roster',
                        'depth': ''
                    },
                    # TODO: this is commented out until we complete the deep linking work, AN-6671
                    # {
                    #     'title': _('Who has been active recently?'),
                    #     'view': 'courses:learners:learners',  # TODO: map this to the actual action in AN-6205
                    #     # TODO: what would the breadcrumbs be?
                    #     'breadcrumbs': [_('Learners')]
                    # },
                    # {
                    #     'title': _('Who is most engaged in the discussions?'),
                    #     'view': 'courses:learners:learners',  # TODO: map this to the actual action in AN-6205
                    #     # TODO: what would the breadcrumbs be?
                    #     'breadcrumbs': [_('Learners')]
                    # },
                    # {
                    #     'title': _("Who hasn't watched videos recently?"),
                    #     'view': 'courses:learners:learners',  # TODO: map this to the actual action in AN-6205
                    #     # TODO: what would the breadcrumbs be?
                    #     'breadcrumbs': [_('Learners')]
                    # }
                ]
            })

        translate_dict_values(items, ('name', ))
        for item in items:
            translate_dict_values(item['items'], ('title', ))

        return items
示例#3
0
 def render_to_response(self, context, **response_kwargs):
     presenter = CourseReportDownloadPresenter(self.course_id)
     data = presenter.get_report_info(CourseReportDownloadPresenter.PROBLEM_RESPONSES)
     return HttpResponseRedirect(data['download_url'], **response_kwargs)