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
e4c49f3a
Commit
e4c49f3a
authored
Oct 31, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1001 from MITx/feature/victor/inputtypes-refactor
Feature/victor/inputtypes refactor
parents
01f5f592
cf2402ae
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
22 deletions
+15
-22
common/lib/capa/capa/correctmap.py
+1
-1
common/lib/capa/capa/inputtypes.py
+1
-1
common/lib/capa/capa/responsetypes.py
+4
-6
common/lib/xmodule/xmodule/capa_module.py
+0
-6
lms/djangoapps/courseware/module_render.py
+9
-8
No files found.
common/lib/capa/capa/correctmap.py
View file @
e4c49f3a
...
@@ -68,7 +68,7 @@ class CorrectMap(object):
...
@@ -68,7 +68,7 @@ class CorrectMap(object):
correct_map is saved by LMS as a plaintext JSON dump of the correctmap dict. This
correct_map is saved by LMS as a plaintext JSON dump of the correctmap dict. This
means that when the definition of CorrectMap (e.g. its properties) are altered,
means that when the definition of CorrectMap (e.g. its properties) are altered,
an existing correct_map dict not coincide with the newest CorrectMap format as
an existing correct_map dict
will
not coincide with the newest CorrectMap format as
defined by self.set.
defined by self.set.
For graceful migration, feed the contents of each correct map to self.set, rather than
For graceful migration, feed the contents of each correct map to self.set, rather than
...
...
common/lib/capa/capa/inputtypes.py
View file @
e4c49f3a
...
@@ -396,7 +396,7 @@ class FileSubmission(InputTypeBase):
...
@@ -396,7 +396,7 @@ class FileSubmission(InputTypeBase):
self
.
required_files
=
saxutils
.
escape
(
self
.
required_files
,
escapedict
)
self
.
required_files
=
saxutils
.
escape
(
self
.
required_files
,
escapedict
)
# Check if problem has been queued
# Check if problem has been queued
queue_len
=
0
self
.
queue_len
=
0
# Flag indicating that the problem has been queued, 'msg' is length of queue
# Flag indicating that the problem has been queued, 'msg' is length of queue
if
self
.
status
==
'incomplete'
:
if
self
.
status
==
'incomplete'
:
self
.
status
=
'queued'
self
.
status
=
'queued'
...
...
common/lib/capa/capa/responsetypes.py
View file @
e4c49f3a
...
@@ -81,7 +81,7 @@ class LoncapaResponse(object):
...
@@ -81,7 +81,7 @@ class LoncapaResponse(object):
by __init__
by __init__
- check_hint_condition : check to see if the student's answers satisfy a particular
- check_hint_condition : check to see if the student's answers satisfy a particular
condition for a hint to be displayed
condition for a hint to be displayed
- render_html : render this Response as HTML (must return XHTML-compliant string)
- render_html : render this Response as HTML (must return XHTML-compliant string)
- __unicode__ : unicode representation of this Response
- __unicode__ : unicode representation of this Response
...
@@ -149,6 +149,7 @@ class LoncapaResponse(object):
...
@@ -149,6 +149,7 @@ class LoncapaResponse(object):
# for convenience
# for convenience
self
.
answer_id
=
self
.
answer_ids
[
0
]
self
.
answer_id
=
self
.
answer_ids
[
0
]
# map input_id -> maxpoints
self
.
maxpoints
=
dict
()
self
.
maxpoints
=
dict
()
for
inputfield
in
self
.
inputfields
:
for
inputfield
in
self
.
inputfields
:
# By default, each answerfield is worth 1 point
# By default, each answerfield is worth 1 point
...
@@ -280,17 +281,14 @@ class LoncapaResponse(object):
...
@@ -280,17 +281,14 @@ class LoncapaResponse(object):
(correctness, npoints, msg) for each answer_id.
(correctness, npoints, msg) for each answer_id.
Arguments:
Arguments:
- student_answers : dict of (answer_id,answer) where answer = student input (string)
- student_answers : dict of (answer_id, answer) where answer = student input (string)
- old_cmap : previous CorrectMap (may be empty); useful for analyzing or
recording history of responses
'''
'''
pass
pass
@abc.abstractmethod
@abc.abstractmethod
def
get_answers
(
self
):
def
get_answers
(
self
):
'''
'''
Return a dict of (answer_id,answer_text) for each answer for this question.
Return a dict of (answer_id,
answer_text) for each answer for this question.
'''
'''
pass
pass
...
...
common/lib/xmodule/xmodule/capa_module.py
View file @
e4c49f3a
...
@@ -538,15 +538,9 @@ class CapaModule(XModule):
...
@@ -538,15 +538,9 @@ class CapaModule(XModule):
lcp_id
=
self
.
lcp
.
problem_id
lcp_id
=
self
.
lcp
.
problem_id
correct_map
=
self
.
lcp
.
grade_answers
(
answers
)
correct_map
=
self
.
lcp
.
grade_answers
(
answers
)
except
StudentInputError
as
inst
:
except
StudentInputError
as
inst
:
# TODO (vshnayder): why is this line here?
#self.lcp = LoncapaProblem(self.definition['data'],
# id=lcp_id, state=old_state, system=self.system)
log
.
exception
(
"StudentInputError in capa_module:problem_check"
)
log
.
exception
(
"StudentInputError in capa_module:problem_check"
)
return
{
'success'
:
inst
.
message
}
return
{
'success'
:
inst
.
message
}
except
Exception
,
err
:
except
Exception
,
err
:
# TODO: why is this line here?
#self.lcp = LoncapaProblem(self.definition['data'],
# id=lcp_id, state=old_state, system=self.system)
if
self
.
system
.
DEBUG
:
if
self
.
system
.
DEBUG
:
msg
=
"Error checking problem: "
+
str
(
err
)
msg
=
"Error checking problem: "
+
str
(
err
)
msg
+=
'
\n
Traceback:
\n
'
+
traceback
.
format_exc
()
msg
+=
'
\n
Traceback:
\n
'
+
traceback
.
format_exc
()
...
...
lms/djangoapps/courseware/module_render.py
View file @
e4c49f3a
...
@@ -337,7 +337,7 @@ def xqueue_callback(request, course_id, userid, id, dispatch):
...
@@ -337,7 +337,7 @@ def xqueue_callback(request, course_id, userid, id, dispatch):
'''
'''
# Test xqueue package, which we expect to be:
# Test xqueue package, which we expect to be:
# xpackage = {'xqueue_header': json.dumps({'lms_key':'secretkey',...}),
# xpackage = {'xqueue_header': json.dumps({'lms_key':'secretkey',...}),
# 'xqueue_body' : 'Message from grader}
# 'xqueue_body' : 'Message from grader
'
}
get
=
request
.
POST
.
copy
()
get
=
request
.
POST
.
copy
()
for
key
in
[
'xqueue_header'
,
'xqueue_body'
]:
for
key
in
[
'xqueue_header'
,
'xqueue_body'
]:
if
not
get
.
has_key
(
key
):
if
not
get
.
has_key
(
key
):
...
@@ -372,7 +372,8 @@ def xqueue_callback(request, course_id, userid, id, dispatch):
...
@@ -372,7 +372,8 @@ def xqueue_callback(request, course_id, userid, id, dispatch):
# We go through the "AJAX" path
# We go through the "AJAX" path
# So far, the only dispatch from xqueue will be 'score_update'
# So far, the only dispatch from xqueue will be 'score_update'
try
:
try
:
ajax_return
=
instance
.
handle_ajax
(
dispatch
,
get
)
# Can ignore the "ajax" return in 'xqueue_callback'
# Can ignore the return value--not used for xqueue_callback
instance
.
handle_ajax
(
dispatch
,
get
)
except
:
except
:
log
.
exception
(
"error processing ajax call"
)
log
.
exception
(
"error processing ajax call"
)
raise
raise
...
@@ -386,12 +387,12 @@ def xqueue_callback(request, course_id, userid, id, dispatch):
...
@@ -386,12 +387,12 @@ def xqueue_callback(request, course_id, userid, id, dispatch):
#Bin score into range and increment stats
#Bin score into range and increment stats
score_bucket
=
get_score_bucket
(
instance_module
.
grade
,
instance_module
.
max_grade
)
score_bucket
=
get_score_bucket
(
instance_module
.
grade
,
instance_module
.
max_grade
)
org
,
course_num
,
run
=
course_id
.
split
(
"/"
)
org
,
course_num
,
run
=
course_id
.
split
(
"/"
)
statsd
.
increment
(
"lms.courseware.question_answered"
,
statsd
.
increment
(
"lms.courseware.question_answered"
,
tags
=
[
"org:{0}"
.
format
(
org
),
tags
=
[
"org:{0}"
.
format
(
org
),
"course:{0}"
.
format
(
course_num
),
"course:{0}"
.
format
(
course_num
),
"run:{0}"
.
format
(
run
),
"run:{0}"
.
format
(
run
),
"score_bucket:{0}"
.
format
(
score_bucket
),
"score_bucket:{0}"
.
format
(
score_bucket
),
"type:xqueue"
])
"type:xqueue"
])
return
HttpResponse
(
""
)
return
HttpResponse
(
""
)
...
@@ -479,12 +480,12 @@ def modx_dispatch(request, dispatch, location, course_id):
...
@@ -479,12 +480,12 @@ def modx_dispatch(request, dispatch, location, course_id):
#Bin score into range and increment stats
#Bin score into range and increment stats
score_bucket
=
get_score_bucket
(
instance_module
.
grade
,
instance_module
.
max_grade
)
score_bucket
=
get_score_bucket
(
instance_module
.
grade
,
instance_module
.
max_grade
)
org
,
course_num
,
run
=
course_id
.
split
(
"/"
)
org
,
course_num
,
run
=
course_id
.
split
(
"/"
)
statsd
.
increment
(
"lms.courseware.question_answered"
,
statsd
.
increment
(
"lms.courseware.question_answered"
,
tags
=
[
"org:{0}"
.
format
(
org
),
tags
=
[
"org:{0}"
.
format
(
org
),
"course:{0}"
.
format
(
course_num
),
"course:{0}"
.
format
(
course_num
),
"run:{0}"
.
format
(
run
),
"run:{0}"
.
format
(
run
),
"score_bucket:{0}"
.
format
(
score_bucket
),
"score_bucket:{0}"
.
format
(
score_bucket
),
"type:ajax"
])
"type:ajax"
])
...
...
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