Commit c1447955 by David Ormsbee

Re-enable a couple of analytics on the dashboard to test layout

parent d0bff1ed
...@@ -8,6 +8,7 @@ import logging ...@@ -8,6 +8,7 @@ import logging
import os import os
import re import re
import requests import requests
from requests.status_codes import codes
import urllib import urllib
import datetime import datetime
from datetime import datetime, timedelta from datetime import datetime, timedelta
...@@ -612,40 +613,46 @@ def instructor_dashboard(request, course_id): ...@@ -612,40 +613,46 @@ def instructor_dashboard(request, course_id):
# use instead: json.loads(req.content, object_pairs_hook=OrderedDict) # use instead: json.loads(req.content, object_pairs_hook=OrderedDict)
# number of students enrolled in this course # number of students enrolled in this course
req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsEnrolled&course_id=%s" % course_id) res = requests.get(settings.ANALYTICS_SERVER_URL +
if req.content != 'None': "get?aname=StudentsEnrolled&course_id=%s" % course_id)
students_enrolled_json = json.loads(req.content, object_pairs_hook=OrderedDict) if res.status_code == codes.OK:
students_enrolled_json = json.loads(res.content,
# number of students active in the past 7 days (including current day), i.e. with at least one activity for the period object_pairs_hook=OrderedDict)
#req = requests.get(settings.ANALYTICS_SERVER_URL + "get_analytics?aname=StudentsActive&course_id=%s&from=%s" % (course_id,from_day)) else:
req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsActive&course_id=%s" % (course_id,)) # default is active past 7 days students_enrolled_json = None
if req.content != 'None':
students_active_json = json.loads(req.content, object_pairs_hook=OrderedDict)
# # number of students active in the past 7 days (including current day), i.e. with at least one activity for the period
# #req = requests.get(settings.ANALYTICS_SERVER_URL + "get_analytics?aname=StudentsActive&course_id=%s&from=%s" % (course_id,from_day))
# req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsActive&course_id=%s" % (course_id,)) # default is active past 7 days
# if req.content != 'None':
# students_active_json = json.loads(req.content, object_pairs_hook=OrderedDict)
#
# number of students per problem who have problem graded correct # number of students per problem who have problem graded correct
req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsPerProblemCorrect&course_id=%s" % (course_id,)) res = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsPerProblemCorrect&course_id=%s" % (course_id,))
if req.content != 'None': if res.status_code == codes.OK:
students_per_problem_correct_json = json.loads(req.content, object_pairs_hook=OrderedDict) students_per_problem_correct_json = json.loads(res.content, object_pairs_hook=OrderedDict)
else:
students_per_problem_correct_json = None
# number of students per problem who have problem graded correct <<< THIS IS FOR ACTIVE STUDENTS # # number of students per problem who have problem graded correct <<< THIS IS FOR ACTIVE STUDENTS
# req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsPerProblemCorrect&course_id=%s&from=%s" % (course_id,from_day)) # # req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsPerProblemCorrect&course_id=%s&from=%s" % (course_id,from_day))
# # if req.content != 'None':
# # students_per_problem_correct_json = json.loads(req.content, object_pairs_hook=OrderedDict)
#
# # grade distribution for the course +++ this is not the desired distribution +++
# req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=OverallGradeDistribution&course_id=%s" % (course_id,))
# if req.content != 'None': # if req.content != 'None':
# students_per_problem_correct_json = json.loads(req.content, object_pairs_hook=OrderedDict) # overall_grade_distribution = json.loads(req.content, object_pairs_hook=OrderedDict)
#
# grade distribution for the course +++ this is not the desired distribution +++ # # number of students distribution drop off per day
req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=OverallGradeDistribution&course_id=%s" % (course_id,)) # req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsDropoffPerDay&course_id=%s&from=%s" % (course_id,from_day))
if req.content != 'None': # if req.content != 'None':
overall_grade_distribution = json.loads(req.content, object_pairs_hook=OrderedDict) # dropoff_per_day = json.loads(req.content, object_pairs_hook=OrderedDict)
#
# number of students distribution drop off per day # # number of students per problem who attempted this problem at least once
req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsDropoffPerDay&course_id=%s&from=%s" % (course_id,from_day)) # req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsAttemptedProblems&course_id=%s" % course_id)
if req.content != 'None': # if req.content != 'None':
dropoff_per_day = json.loads(req.content, object_pairs_hook=OrderedDict) # attempted_problems = json.loads(req.content, object_pairs_hook=OrderedDict)
# number of students per problem who attempted this problem at least once
req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsAttemptedProblems&course_id=%s" % course_id)
if req.content != 'None':
attempted_problems = json.loads(req.content, object_pairs_hook=OrderedDict)
# number of students active in the past 7 days (including current day) --- online version! experimental # number of students active in the past 7 days (including current day) --- online version! experimental
...@@ -684,12 +691,13 @@ def instructor_dashboard(request, course_id): ...@@ -684,12 +691,13 @@ def instructor_dashboard(request, course_id):
# The following are specific analytics metrics that should be # The following are specific analytics metrics that should be
# put in their own space... # put in their own space...
'students_enrolled_json' : students_enrolled_json, 'students_enrolled_json' : students_enrolled_json,
'students_active_json' : students_active_json, # 'students_active_json' : students_active_json,
'daily_activity_json' : daily_activity_json, # 'daily_activity_json' : daily_activity_json,
'students_per_problem_correct_json' : students_per_problem_correct_json, 'students_per_problem_correct_json' : students_per_problem_correct_json,
'overall_grade_distribution' : overall_grade_distribution, # 'overall_grade_distribution' : overall_grade_distribution,
'dropoff_per_day' : dropoff_per_day, # 'dropoff_per_day' : dropoff_per_day,
'attempted_problems' : attempted_problems, # 'attempted_problems' : attempted_problems
}
return render_to_response('courseware/instructor_dashboard.html', context) return render_to_response('courseware/instructor_dashboard.html', context)
......
...@@ -372,6 +372,33 @@ function goto( mode) ...@@ -372,6 +372,33 @@ function goto( mode)
%if modeflag.get('Analytics'): %if modeflag.get('Analytics'):
<p> <p>
Students enrolled:
% if students_enrolled_json and "data" in students_enrolled_json:
${students_enrolled_json['data'][0]['students']}
<!-- ${students_enrolled_json['time']} -->
% endif
</p>
<p>
<p>Number of students per problem who have this problem graded as correct, as of ${students_per_problem_correct_json['time']}</p>
% if students_per_problem_correct_json and "data" in students_per_problem_correct_json:
<div class="divScroll">
<table class="stat_table">
<tr><th>Problem</th><th>Number of students</th></tr>
% for row in students_per_problem_correct_json['data']:
<tr> <td>${row['module_id']}</td> <td>${row['count']}</td> </tr>
% endfor
</table>
</div>
% endif
</p>
%endif
%if modeflag.get('Analytics 2'):
<p>
Number of students enrolled for ${students_enrolled_json['data'][0]['course_id']}: Number of students enrolled for ${students_enrolled_json['data'][0]['course_id']}:
% if students_enrolled_json is not None: % if students_enrolled_json is not None:
% if students_enrolled_json['status'] == 'success': % if students_enrolled_json['status'] == 'success':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment