Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
e40b0d0d
Commit
e40b0d0d
authored
Dec 14, 2012
by
JM Van Thong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed data order when loading json record from request.
parent
27b8f01f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
31 deletions
+19
-31
lms/djangoapps/instructor/views.py
+16
-16
lms/templates/courseware/instructor_dashboard.html
+3
-15
No files found.
lms/djangoapps/instructor/views.py
View file @
e40b0d0d
...
@@ -7,6 +7,8 @@ import os
...
@@ -7,6 +7,8 @@ import os
import
urllib
import
urllib
import
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
import
json
from
collections
import
OrderedDict
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.models
import
User
,
Group
...
@@ -272,11 +274,10 @@ def instructor_dashboard(request, course_id):
...
@@ -272,11 +274,10 @@ def instructor_dashboard(request, course_id):
#----------------------------------------
#----------------------------------------
# analytics
# analytics
a
nalytics_json
=
None
a
ttempted_problems
=
None
students_enrolled_json
=
None
students_enrolled_json
=
None
students_active_json
=
None
students_active_json
=
None
daily_activity_json
=
None
daily_activity_json
=
None
students_daily_activity_json
=
None
students_per_problem_correct_json
=
None
students_per_problem_correct_json
=
None
overall_grade_distribution
=
None
overall_grade_distribution
=
None
dropoff_per_day
=
None
dropoff_per_day
=
None
...
@@ -287,29 +288,32 @@ def instructor_dashboard(request, course_id):
...
@@ -287,29 +288,32 @@ def instructor_dashboard(request, course_id):
to_day
=
datetime
.
today
()
.
date
()
to_day
=
datetime
.
today
()
.
date
()
from_day
=
to_day
-
timedelta
(
days
=
7
)
from_day
=
to_day
-
timedelta
(
days
=
7
)
# WARNING: do not use req.json because the preloaded json doesn't preserve the order of the original record
# number of students enrolled in this course
# number of students enrolled in this course
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=StudentsEnrolled&course_id=
%
s"
%
course_id
)
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=StudentsEnrolled&course_id=
%
s"
%
course_id
)
students_enrolled_json
=
req
.
json
students_enrolled_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
# 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_analytics?aname=StudentsActive&course_id=
%
s&from=
%
s"
%
(
course_id
,
from_day
))
students_active_json
=
req
.
json
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_analytics?aname=StudentsPerProblemCorrect&course_id=
%
s&from=
%
s"
%
(
course_id
,
from_day
))
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=StudentsPerProblemCorrect&course_id=
%
s&from=
%
s"
%
(
course_id
,
from_day
))
students_per_problem_correct_json
=
req
.
json
students_per_problem_correct_json
=
json
.
loads
(
req
.
content
,
object_pairs_hook
=
OrderedDict
)
# grade distribution for the course
# grade distribution for the course
+++ this is not the desired distribution +++
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=OverallGradeDistribution&course_id=
%
s"
%
(
course_id
,))
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=OverallGradeDistribution&course_id=
%
s"
%
(
course_id
,))
overall_grade_distribution
=
req
.
json
overall_grade_distribution
=
json
.
loads
(
req
.
content
,
object_pairs_hook
=
OrderedDict
)
# number of students distribution drop off per day
# number of students distribution drop off per day
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=StudentsDropoffPerDay&course_id=
%
s&from=
%
s"
%
(
course_id
,
from_day
))
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=StudentsDropoffPerDay&course_id=
%
s&from=
%
s"
%
(
course_id
,
from_day
))
dropoff_per_day
=
req
.
json
dropoff_per_day
=
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_analytics?aname=StudentsAttemptedProblems&course_id=
%
s"
%
course_id
)
attempted_problems
=
json
.
loads
(
req
.
content
,
object_pairs_hook
=
OrderedDict
)
# the following is ++incorrect++ use of studentmodule table
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=StudentsDailyActivity&course_id=
%
s&from=
%
s"
%
(
course_id
,
from_day
))
students_daily_activity_json
=
req
.
json
# 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
to_day
=
datetime
.
today
()
.
date
()
to_day
=
datetime
.
today
()
.
date
()
...
@@ -317,9 +321,6 @@ def instructor_dashboard(request, course_id):
...
@@ -317,9 +321,6 @@ def instructor_dashboard(request, course_id):
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=DailyActivityAnalyzer&course_id=
%
s&from=
%
s&to=
%
s"
%
(
course_id
,
from_day
,
to_day
))
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=DailyActivityAnalyzer&course_id=
%
s&from=
%
s&to=
%
s"
%
(
course_id
,
from_day
,
to_day
))
daily_activity_json
=
req
.
json
daily_activity_json
=
req
.
json
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=StudentsPerHomework&course_id=
%
s"
%
course_id
)
analytics_json
=
req
.
json
#----------------------------------------
#----------------------------------------
# context for rendering
# context for rendering
context
=
{
'course'
:
course
,
context
=
{
'course'
:
course
,
...
@@ -334,14 +335,13 @@ def instructor_dashboard(request, course_id):
...
@@ -334,14 +335,13 @@ def instructor_dashboard(request, course_id):
'plots'
:
plots
,
# psychometrics
'plots'
:
plots
,
# psychometrics
'course_errors'
:
modulestore
()
.
get_item_errors
(
course
.
location
),
'course_errors'
:
modulestore
()
.
get_item_errors
(
course
.
location
),
'djangopid'
:
os
.
getpid
(),
'djangopid'
:
os
.
getpid
(),
'analytics_json'
:
analytics_json
,
'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_daily_activity_json'
:
students_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
,
}
}
return
render_to_response
(
'courseware/instructor_dashboard.html'
,
context
)
return
render_to_response
(
'courseware/instructor_dashboard.html'
,
context
)
...
...
lms/templates/courseware/instructor_dashboard.html
View file @
e40b0d0d
...
@@ -177,10 +177,10 @@ function goto( mode)
...
@@ -177,10 +177,10 @@ function goto( mode)
%if modeflag.get('Analytics'):
%if modeflag.get('Analytics'):
<p>
<p>
Number of students enrolled: ${students_enrolled_json['data']['
nb_students_enrolled
']}
Number of students enrolled: ${students_enrolled_json['data']['
value
']}
</p>
</p>
<p>
<p>
Number of active students for the past 7 days: ${students_active_json['data']['
nb_students_activ
e']}
Number of active students for the past 7 days: ${students_active_json['data']['
valu
e']}
</p>
</p>
<p>
<p>
...
@@ -233,7 +233,7 @@ function goto( mode)
...
@@ -233,7 +233,7 @@ function goto( mode)
<div
class=
"divScroll"
>
<div
class=
"divScroll"
>
<table
class=
"stat_table"
>
<table
class=
"stat_table"
>
<tr><th>
Module
</th><th>
Number of students
</th></tr>
<tr><th>
Module
</th><th>
Number of students
</th></tr>
% for k,v in a
nalytics_json
['data'].items():
% for k,v in a
ttempted_problems
['data'].items():
<tr>
<tr>
<td>
${k}
</td>
<td>
${v}
</td>
<td>
${k}
</td>
<td>
${v}
</td>
</tr>
</tr>
...
@@ -255,18 +255,6 @@ function goto( mode)
...
@@ -255,18 +255,6 @@ function goto( mode)
</table>
</table>
</p>
</p>
<p>
<h2>
Daily activity for the past 7 days:
</h2>
<table
class=
"stat_table"
>
<tr><th>
Day
</td><th>
Number of students
</td></tr>
% for k,v in students_daily_activity_json['data'].items():
<tr>
<td>
${k}
</td>
<td>
${v}
</td>
</tr>
% endfor
</table>
</p>
%endif
%endif
##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment