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
38683515
Commit
38683515
authored
Apr 17, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added histogram graph for courseware administrators.
parent
eff95c26
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
6 deletions
+52
-6
djangoapps/courseware/module_render.py
+8
-3
templates/courseware.html
+5
-0
templates/staff_problem_histogram.js
+38
-0
templates/staff_problem_info.html
+1
-3
No files found.
djangoapps/courseware/module_render.py
View file @
38683515
...
...
@@ -144,12 +144,17 @@ def render_x_module(user, request, xml_module, module_object_preload):
module_object_preload
.
append
(
smod
)
# Grab content
content
=
instance
.
get_html
()
init_js
=
instance
.
get_init_js
()
destory_js
=
instance
.
get_destroy_js
()
if
user
.
is_staff
:
content
=
content
+
render_to_string
(
"staff_problem_info.html"
,
{
'xml'
:
etree
.
tostring
(
xml_module
),
'histogram'
:
grade_histogram
(
module_id
)})
'module_id'
:
module_id
})
init_js
=
init_js
+
render_to_string
(
"staff_problem_histogram.js"
,
{
'histogram'
:
grade_histogram
(
module_id
),
'module_id'
:
module_id
})
content
=
{
'content'
:
content
,
"destroy_js"
:
instance
.
get_destroy_js
()
,
'init_js'
:
in
stance
.
get_init_js
()
,
"destroy_js"
:
destory_js
,
'init_js'
:
in
it_js
,
'type'
:
module_type
}
return
content
...
...
templates/courseware.html
View file @
38683515
<
%
inherit
file=
"main.html"
/>
<
%
block
name=
"title"
><title>
Courseware – MITx 6.002x
</title></
%
block>
<
%
block
name=
"headextra"
>
<script
type=
"text/javascript"
src=
"/static/js/flot/jquery.flot.js"
></script>
</
%
block>
<
%
block
name=
"js_extra"
>
##Is there a reason this isn't in header_extra? Is it important that the javascript is at the bottom of the generated document?
<!-- TODO: http://docs.jquery.com/Plugins/Validation -->
<script
type=
"text/javascript"
>
$
(
function
()
{
...
...
templates/staff_problem_histogram.js
0 → 100644
View file @
38683515
<%!
import
json
import
math
%>
<%
data
=
[]
xticks
=
[]
yticks
=
[]
maxx
=
1
maxy
=
1.5
for
score
,
count
in
histogram
:
score
=
score
or
0
#
Sometimes
score
is
None
.
This
fixes
that
log_count
=
math
.
log
(
count
+
1
)
data
.
append
(
[
score
,
log_count
]
)
yticks
.
append
(
[
log_count
,
str
(
count
)]
)
xticks
.
append
(
[
score
,
str
(
int
(
score
))]
)
maxx
=
max
(
score
+
1
,
maxx
)
maxy
=
max
(
log_count
*
1.1
,
maxy
)
%>
$
.
plot
(
$
(
"#histogram_${module_id}"
),
[{
data
:
$
{
json
.
dumps
(
data
)
},
bars
:
{
show
:
true
,
align
:
'center'
,
lineWidth
:
0
,
fill
:
1.0
},
color
:
"#600101"
,
}],
{
xaxis
:
{
min
:
-
1
,
max
:
$
{
maxx
},
ticks
:
$
{
json
.
dumps
(
xticks
)
}},
yaxis
:
{
min
:
0.0
,
max
:
$
{
maxy
},
ticks
:
$
{
json
.
dumps
(
yticks
)
},
labelWidth
:
50
},
});
templates/staff_problem_info.html
View file @
38683515
<div
class=
"staff_info"
>
${xml | h}
</div>
<div>
${ str(histogram) }
</div>
<div
id=
"histogram_${module_id}"
style=
"width:200px;height:150px"
></div>
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