Ejemplo n.º 1
0
 def test_build_json_tree(self):
     tree = {'text': 'Empty',
             'a_attr': {'href': '#'},
             'state': {'opened': True},
             'children': [
                 {'text': None,
                  'a_attr': {'href': '#'},
                  'state': {'opened': True},
                  'children': [
                      {'text': None,
                       'a_attr': {'href': '#'},
                       'state': {'opened': True},
                       'children': [
                           {'text': None,
                            'a_attr': {'href': '#'},
                            'state': {'opened': True},
                            'children': [
                                {'text': 'Blank Advanced Problem',
                                 'a_attr': {'href': "/courses/{}/fun/dashboard/problem_stats/get_stats/89b2ed2a06ce4f9f8dcd26fee087b60a".format(str(self.course.id))},
                                 'state': {'opened': True},
                                 'children': [],
                                 'li_attr': {'category': 'problem',
                                             'report_url': "/courses/{}/fun/dashboard/reports_manager/generate/89b2ed2a06ce4f9f8dcd26fee087b60a/".format(str(self.course.id))},
                                 'icon': 'glyphicon glyphicon-pencil'}],
                            'li_attr': {'category': 'other', 'report_url': '#'},
                            'icon': 'default'}],
                       'li_attr': {'category': 'other', 'report_url': '#'},
                       'icon': 'default'}],
                  'li_attr': {'category': 'other', 'report_url': '#'},
                  'icon': 'default'}],
             'li_attr': {'category': 'other', 'report_url': '#'},
             'icon': 'default'}
     course_tree = build_course_tree(self.course)
     self.assertEqual(tree, course_tree)
Ejemplo n.º 2
0
def index(request, course_id):
    """ Render the course tree with all course problems (LoncapaProblem).

    Args:
         course_id (str): The course id as string.
    """
    start_time = time.time()

    # Does the course exist?
    course_key = CourseKey.from_string(course_id)
    course = modulestore().get_course(course_key)
    if course is None:
        raise Http404()

    course_tree = utils.build_course_tree(course)

    tracker.emit("course_dashboard.problem_stats.views.index",
                 {'task-time': time.time() - start_time})

    return render(
        request, 'problem_stats/index.html', {
            "course_id": course_id,
            "course_tree_data": json.dumps(course_tree),
            'active_tab': 'answers_distribution'
        })
Ejemplo n.º 3
0
def index(request, course_id):
    """ Render the course tree with all course problems (LoncapaProblem).

    Args:
         course_id (str): The course id as string.
    """
    start_time = time.time()

    store = modulestore()
    course_key = CourseKey.from_string(course_id)
    course_tree = utils.build_course_tree(store.get_course(course_key))

    tracker.emit("course_dashboard.problem_stats.views.index",
                 {'task-time' : time.time() - start_time})

    return render(request, 'problem_stats/index.html', {
        "course_id": course_id,
        "course_tree_data" : json.dumps(course_tree)
    })
Ejemplo n.º 4
0
def index(request, course_id):
    """ Render the course tree with all course problems (LoncapaProblem).

    Args:
         course_id (str): The course id as string.
    """
    start_time = time.time()

    # Does the course exist?
    course_key = CourseKey.from_string(course_id)
    course = modulestore().get_course(course_key)
    if course is None:
        raise Http404()

    course_tree = utils.build_course_tree(course)

    tracker.emit("course_dashboard.problem_stats.views.index",
                 {'task-time': time.time() - start_time})

    return render(request, 'problem_stats/index.html', {
        "course_id": course_id,
        "course_tree_data": json.dumps(course_tree),
        'active_tab': 'answers_distribution'
    })
Ejemplo n.º 5
0
 def test_build_json_tree(self):
     tree = {
         'text':
         self.course_descriptor.name,
         'a_attr': {
             'href': '#'
         },
         'state': {
             'opened': True
         },
         'children': [{
             'text':
             'N/A',
             'a_attr': {
                 'href': '#'
             },
             'state': {
                 'opened': True
             },
             'children': [{
                 'text':
                 'N/A',
                 'a_attr': {
                     'href': '#'
                 },
                 'state': {
                     'opened': True
                 },
                 'children': [{
                     'text':
                     'N/A',
                     'a_attr': {
                         'href': '#'
                     },
                     'state': {
                         'opened': True
                     },
                     'children': [{
                         'text': u"Blank Advanced Problem",
                         'a_attr': {
                             'href':
                             u"/courses/{}/fun/dashboard/problem_stats/get_stats/89b2ed2a06ce4f9f8dcd26fee087b60a"
                             .format(str(self.course.id))
                         },
                         'state': {
                             'opened': True
                         },
                         'children': [],
                         'li_attr': {
                             'category':
                             'problem',
                             'report_url':
                             u"/courses/{}/fun/dashboard/reports_manager/generate/89b2ed2a06ce4f9f8dcd26fee087b60a/"
                             .format(str(self.course.id))
                         },
                         'icon': 'glyphicon glyphicon-pencil'
                     }],
                     'li_attr': {
                         'category': 'other',
                         'report_url': '#'
                     },
                     'icon':
                     'default'
                 }],
                 'li_attr': {
                     'category': 'other',
                     'report_url': '#'
                 },
                 'icon':
                 'default'
             }],
             'li_attr': {
                 'category': 'other',
                 'report_url': '#'
             },
             'icon':
             'default'
         }],
         'li_attr': {
             'category': 'other',
             'report_url': '#'
         },
         'icon':
         'default'
     }
     course_tree = build_course_tree(self.course)
     self.maxDiff = None
     self.assertEqual(tree, course_tree)