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
22017ac2
Commit
22017ac2
authored
Apr 04, 2013
by
Jay Zoldak
Committed by
Jay Zoldak
Apr 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8 fixes for psychoanalyze and capa module
parent
1717782c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
18 deletions
+11
-18
common/lib/xmodule/xmodule/capa_module.py
+8
-14
common/lib/xmodule/xmodule/tests/test_capa_module.py
+0
-0
lms/djangoapps/psychometrics/psychoanalyze.py
+3
-4
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
22017ac2
...
@@ -108,11 +108,10 @@ class CapaModule(CapaFields, XModule):
...
@@ -108,11 +108,10 @@ class CapaModule(CapaFields, XModule):
'''
'''
icon_class
=
'problem'
icon_class
=
'problem'
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/capa/display.coffee'
),
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/capa/display.coffee'
),
resource_string
(
__name__
,
'js/src/collapsible.coffee'
),
resource_string
(
__name__
,
'js/src/collapsible.coffee'
),
resource_string
(
__name__
,
'js/src/javascript_loader.coffee'
),
resource_string
(
__name__
,
'js/src/javascript_loader.coffee'
),
],
],
'js'
:
[
resource_string
(
__name__
,
'js/src/capa/imageinput.js'
),
'js'
:
[
resource_string
(
__name__
,
'js/src/capa/imageinput.js'
),
resource_string
(
__name__
,
'js/src/capa/schematic.js'
)
resource_string
(
__name__
,
'js/src/capa/schematic.js'
)
]}
]}
...
@@ -367,11 +366,11 @@ class CapaModule(CapaFields, XModule):
...
@@ -367,11 +366,11 @@ class CapaModule(CapaFields, XModule):
self
.
set_state_from_lcp
()
self
.
set_state_from_lcp
()
# Prepend a scary warning to the student
# Prepend a scary warning to the student
warning
=
'<div class="capa_reset">'
\
warning
=
'<div class="capa_reset">'
\
'<h2>Warning: The problem has been reset to its initial state!</h2>'
\
'<h2>Warning: The problem has been reset to its initial state!</h2>'
\
'The problem
\'
s state was corrupted by an invalid submission. '
\
'The problem
\'
s state was corrupted by an invalid submission. '
\
'The submission consisted of:'
\
'The submission consisted of:'
\
'<ul>'
'<ul>'
for
student_answer
in
student_answers
.
values
():
for
student_answer
in
student_answers
.
values
():
if
student_answer
!=
''
:
if
student_answer
!=
''
:
warning
+=
'<li>'
+
cgi
.
escape
(
student_answer
)
+
'</li>'
warning
+=
'<li>'
+
cgi
.
escape
(
student_answer
)
+
'</li>'
...
@@ -388,7 +387,6 @@ class CapaModule(CapaFields, XModule):
...
@@ -388,7 +387,6 @@ class CapaModule(CapaFields, XModule):
return
html
return
html
def
get_problem_html
(
self
,
encapsulate
=
True
):
def
get_problem_html
(
self
,
encapsulate
=
True
):
'''Return html for the problem. Adds check, reset, save buttons
'''Return html for the problem. Adds check, reset, save buttons
as necessary based on the problem config and state.'''
as necessary based on the problem config and state.'''
...
@@ -401,7 +399,6 @@ class CapaModule(CapaFields, XModule):
...
@@ -401,7 +399,6 @@ class CapaModule(CapaFields, XModule):
except
Exception
,
err
:
except
Exception
,
err
:
html
=
self
.
handle_problem_html_error
(
err
)
html
=
self
.
handle_problem_html_error
(
err
)
# The convention is to pass the name of the check button
# The convention is to pass the name of the check button
# if we want to show a check button, and False otherwise
# if we want to show a check button, and False otherwise
# This works because non-empty strings evaluate to True
# This works because non-empty strings evaluate to True
...
@@ -454,7 +451,7 @@ class CapaModule(CapaFields, XModule):
...
@@ -454,7 +451,7 @@ class CapaModule(CapaFields, XModule):
'score_update'
:
self
.
update_score
,
'score_update'
:
self
.
update_score
,
'input_ajax'
:
self
.
handle_input_ajax
,
'input_ajax'
:
self
.
handle_input_ajax
,
'ungraded_response'
:
self
.
handle_ungraded_response
'ungraded_response'
:
self
.
handle_ungraded_response
}
}
if
dispatch
not
in
handlers
:
if
dispatch
not
in
handlers
:
return
'Error'
return
'Error'
...
@@ -472,7 +469,7 @@ class CapaModule(CapaFields, XModule):
...
@@ -472,7 +469,7 @@ class CapaModule(CapaFields, XModule):
d
.
update
({
d
.
update
({
'progress_changed'
:
after
!=
before
,
'progress_changed'
:
after
!=
before
,
'progress_status'
:
Progress
.
to_js_status_str
(
after
),
'progress_status'
:
Progress
.
to_js_status_str
(
after
),
})
})
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
def
is_past_due
(
self
):
def
is_past_due
(
self
):
...
@@ -535,7 +532,6 @@ class CapaModule(CapaFields, XModule):
...
@@ -535,7 +532,6 @@ class CapaModule(CapaFields, XModule):
return
False
return
False
def
update_score
(
self
,
get
):
def
update_score
(
self
,
get
):
"""
"""
Delivers grading response (e.g. from asynchronous code checking) to
Delivers grading response (e.g. from asynchronous code checking) to
...
@@ -590,7 +586,6 @@ class CapaModule(CapaFields, XModule):
...
@@ -590,7 +586,6 @@ class CapaModule(CapaFields, XModule):
self
.
set_state_from_lcp
()
self
.
set_state_from_lcp
()
return
response
return
response
def
get_answer
(
self
,
get
):
def
get_answer
(
self
,
get
):
'''
'''
For the "show answer" button.
For the "show answer" button.
...
@@ -700,7 +695,6 @@ class CapaModule(CapaFields, XModule):
...
@@ -700,7 +695,6 @@ class CapaModule(CapaFields, XModule):
'max_value'
:
score
[
'total'
],
'max_value'
:
score
[
'total'
],
})
})
def
check_problem
(
self
,
get
):
def
check_problem
(
self
,
get
):
''' Checks whether answers to a problem are correct, and
''' Checks whether answers to a problem are correct, and
returns a map of correct/incorrect answers:
returns a map of correct/incorrect answers:
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
22017ac2
This diff is collapsed.
Click to expand it.
lms/djangoapps/psychometrics/psychoanalyze.py
View file @
22017ac2
...
@@ -15,7 +15,6 @@ from scipy.optimize import curve_fit
...
@@ -15,7 +15,6 @@ from scipy.optimize import curve_fit
from
django.conf
import
settings
from
django.conf
import
settings
from
django.db.models
import
Sum
,
Max
from
django.db.models
import
Sum
,
Max
from
psychometrics.models
import
*
from
psychometrics.models
import
*
from
xmodule.modulestore
import
Location
log
=
logging
.
getLogger
(
"mitx.psychometrics"
)
log
=
logging
.
getLogger
(
"mitx.psychometrics"
)
...
@@ -292,7 +291,7 @@ def generate_plots_for_problem(problem):
...
@@ -292,7 +291,7 @@ def generate_plots_for_problem(problem):
'info'
:
''
,
'info'
:
''
,
'data'
:
jsdata
,
'data'
:
jsdata
,
'cmd'
:
'[
%
s],
%
s'
%
(
','
.
join
(
jsplots
),
axisopts
),
'cmd'
:
'[
%
s],
%
s'
%
(
','
.
join
(
jsplots
),
axisopts
),
})
})
#log.debug('plots = %s' % plots)
#log.debug('plots = %s' % plots)
return
msg
,
plots
return
msg
,
plots
...
@@ -333,9 +332,9 @@ def make_psychometrics_data_update_handler(course_id, user, module_state_key):
...
@@ -333,9 +332,9 @@ def make_psychometrics_data_update_handler(course_id, user, module_state_key):
pmd
.
done
=
done
pmd
.
done
=
done
try
:
try
:
pmd
.
attempts
=
state
.
get
(
'attempts'
,
0
)
pmd
.
attempts
=
state
.
get
(
'attempts'
,
0
)
except
:
except
:
log
.
exception
(
"no attempts for
%
s (state=
%
s)"
%
(
sm
,
sm
.
state
))
log
.
exception
(
"no attempts for
%
s (state=
%
s)"
%
(
sm
,
sm
.
state
))
try
:
try
:
checktimes
=
eval
(
pmd
.
checktimes
)
# update log of attempt timestamps
checktimes
=
eval
(
pmd
.
checktimes
)
# update log of attempt timestamps
...
...
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