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
8a87a4ba
Commit
8a87a4ba
authored
12 years ago
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make staff problem histogram work again
parent
4298c920
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
44 deletions
+48
-44
djangoapps/courseware/module_render.py
+2
-0
static/coffee/spec/calculator_spec.js
+1
-1
static/coffee/spec/feedback_form_spec.js
+1
-1
static/coffee/src/courseware.coffee
+4
-0
static/sass/courseware/_courseware.scss
+4
-0
templates/coffee/spec/navigation_spec.js
+0
-1
templates/coffee/src/histogram.coffee
+35
-0
templates/staff_problem_histogram.js
+0
-40
templates/staff_problem_info.html
+1
-1
No files found.
djangoapps/courseware/module_render.py
View file @
8a87a4ba
import
json
import
logging
from
lxml
import
etree
...
...
@@ -137,6 +138,7 @@ def render_x_module(user, request, xml_module, module_object_preload):
render_histogram
=
len
(
histogram
)
>
0
content
=
content
+
render_to_string
(
"staff_problem_info.html"
,
{
'xml'
:
etree
.
tostring
(
xml_module
),
'module_id'
:
module_id
,
'histogram'
:
json
.
dumps
(
histogram
),
'render_histogram'
:
render_histogram
})
content
=
{
'content'
:
content
,
...
...
This diff is collapsed.
Click to expand it.
static/coffee/spec/calculator_spec.js
View file @
8a87a4ba
...
...
@@ -66,7 +66,7 @@
return
this
.
calculator
.
calculate
();
});
it
(
'send data to /calculate'
,
function
()
{
return
expect
(
$
.
get
JSON
).
toHaveBeenCalledWith
(
'/calculate'
,
{
return
expect
(
$
.
get
WithPrefix
).
toHaveBeenCalledWith
(
'/calculate'
,
{
equation
:
'1+2'
},
jasmine
.
any
(
Function
));
});
...
...
This diff is collapsed.
Click to expand it.
static/coffee/spec/feedback_form_spec.js
View file @
8a87a4ba
...
...
@@ -18,7 +18,7 @@
$
(
'#feedback_subject'
).
val
(
'Awesome!'
);
$
(
'#feedback_message'
).
val
(
'This site is really good.'
);
$
(
'#feedback_button'
).
click
();
return
expect
(
$
.
post
).
toHaveBeenCalledWith
(
'/send_feedback'
,
{
return
expect
(
$
.
post
WithPrefix
).
toHaveBeenCalledWith
(
'/send_feedback'
,
{
subject
:
'Awesome!'
,
message
:
'This site is really good.'
,
url
:
window
.
location
.
href
...
...
This diff is collapsed.
Click to expand it.
static/coffee/src/courseware.coffee
View file @
8a87a4ba
...
...
@@ -22,3 +22,7 @@ class @Courseware
$
(
'.course-content .problems-wrapper'
).
each
->
id
=
$
(
this
).
attr
(
'id'
).
replace
(
/problem_/
,
''
)
new
Problem
id
,
$
(
this
).
data
(
'url'
)
$
(
'.course-content .histogram'
).
each
->
id
=
$
(
this
).
attr
(
'id'
).
replace
(
/histogram_/
,
''
)
new
Histogram
id
,
$
(
this
).
data
(
'histogram'
)
This diff is collapsed.
Click to expand it.
static/sass/courseware/_courseware.scss
View file @
8a87a4ba
...
...
@@ -202,6 +202,10 @@ div.course-wrapper {
padding-bottom
:
0
;
}
.histogram
{
width
:
200px
;
height
:
150px
;
}
ul
{
list-style
:
disc
outside
none
;
...
...
This diff is collapsed.
Click to expand it.
templates/coffee/spec/navigation_spec.js
View file @
8a87a4ba
// Generated by CoffeeScript 1.3.2-pre
(
function
()
{
describe
(
'Navigation'
,
function
()
{
...
...
This diff is collapsed.
Click to expand it.
templates/coffee/src/histogram.coffee
0 → 100644
View file @
8a87a4ba
class
@
Histogram
constructor
:
(
@
id
,
@
rawData
)
->
@
xTicks
=
[]
@
yTicks
=
[]
@
data
=
[]
@
calculate
()
@
render
()
calculate
:
->
for
[
score
,
count
]
in
@
rawData
log_count
=
Math
.
log
(
count
+
1
)
@
data
.
push
[
score
,
log_count
]
@
xTicks
.
push
[
score
,
score
.
toString
()]
@
yTicks
.
push
[
log_count
,
count
.
toString
()]
render
:
->
$
.
plot
$
(
"#histogram_
#{
@
id
}
"
),
[
data
:
@
data
bars
:
show
:
true
align
:
'center'
lineWidth
:
0
fill
:
1.0
color
:
"#b72121"
],
xaxis
:
min
:
-
1
max
:
Math
.
max
$
.
map
(
@
xTicks
,
(
data
)
->
data
[
0
]
+
1
)
ticks
:
@
xTicks
tickLength
:
0
yaxis
:
min
:
0.0
max
:
Math
.
max
$
.
map
(
@
yTicks
,
(
data
)
->
data
[
0
]
*
1.1
)
ticks
:
@
yTicks
labelWidth
:
50
This diff is collapsed.
Click to expand it.
templates/staff_problem_histogram.js
deleted
100644 → 0
View file @
4298c920
<%!
import
json
import
math
%>
var
rawData
=
$
{
json
.
dumps
(
histogram
)};
var
maxx
=
1
;
var
maxy
=
1.5
;
var
xticks
=
Array
();
var
yticks
=
Array
();
var
data
=
Array
();
for
(
var
i
=
0
;
i
<
rawData
.
length
;
i
++
)
{
var
score
=
rawData
[
i
][
0
];
var
count
=
rawData
[
i
][
1
];
var
log_count
=
Math
.
log
(
count
+
1
);
data
.
push
(
[
score
,
log_count
]
);
xticks
.
push
(
[
score
,
score
.
toString
()]
);
yticks
.
push
(
[
log_count
,
count
.
toString
()]
);
maxx
=
Math
.
max
(
score
+
1
,
maxx
);
maxy
=
Math
.
max
(
log_count
*
1.1
,
maxy
);
}
$
.
plot
(
$
(
"#histogram_${module_id}"
),
[{
data
:
data
,
bars
:
{
show
:
true
,
align
:
'center'
,
lineWidth
:
0
,
fill
:
1.0
},
color
:
"#b72121"
,
}],
{
xaxis
:
{
min
:
-
1
,
max
:
maxx
,
ticks
:
xticks
,
tickLength
:
0
},
yaxis
:
{
min
:
0.0
,
max
:
maxy
,
ticks
:
yticks
,
labelWidth
:
50
},
}
);
This diff is collapsed.
Click to expand it.
templates/staff_problem_info.html
View file @
8a87a4ba
...
...
@@ -2,5 +2,5 @@
${xml | h}
</div>
%if render_histogram:
<div
id=
"histogram_${module_id}"
style=
"width:200px;height:150px
"
></div>
<div
id=
"histogram_${module_id}"
class=
"histogram"
data-histogram=
"${histogram}
"
></div>
%endif
This diff is collapsed.
Click to expand it.
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