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
8030bce0
Commit
8030bce0
authored
Jun 10, 2012
by
ichuang
Committed by
Matthew Mongeau
Jun 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfixes - correctmap should reinit self.cmap on init
parent
70e942fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
common/lib/capa/capa_problem.py
+1
-0
common/lib/capa/correctmap.py
+9
-7
common/lib/capa/responsetypes.py
+3
-2
No files found.
common/lib/capa/capa_problem.py
View file @
8030bce0
...
...
@@ -200,6 +200,7 @@ class LoncapaProblem(object):
self
.
student_answers
=
answers
oldcmap
=
self
.
correct_map
# old CorrectMap
newcmap
=
CorrectMap
()
# start new with empty CorrectMap
log
.
debug
(
'Responders:
%
s'
%
self
.
responders
)
for
responder
in
self
.
responders
.
values
():
results
=
responder
.
evaluate_answers
(
answers
,
oldcmap
)
# call the responsetype instance to do the actual grading
newcmap
.
update
(
results
)
...
...
common/lib/capa/correctmap.py
View file @
8030bce0
...
...
@@ -17,11 +17,17 @@ class CorrectMap(object):
Behaves as a dict.
'''
cmap
=
{}
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
cmap
=
dict
()
# start with empty dict
self
.
__getitem__
=
self
.
cmap
.
__getitem__
self
.
__iter__
=
self
.
cmap
.
__iter__
self
.
items
=
self
.
cmap
.
items
self
.
keys
=
self
.
cmap
.
keys
self
.
set
(
*
args
,
**
kwargs
)
def
__iter__
(
self
):
return
self
.
cmap
.
__iter__
()
def
set
(
self
,
answer_id
=
None
,
correctness
=
None
,
npoints
=
None
,
msg
=
''
,
hint
=
''
,
hintmode
=
None
):
if
answer_id
is
not
None
:
self
.
cmap
[
answer_id
]
=
{
'correctness'
:
correctness
,
...
...
@@ -47,7 +53,7 @@ class CorrectMap(object):
dict of dicts format.
'''
if
correct_map
and
not
(
type
(
correct_map
[
correct_map
.
keys
()[
0
]])
==
dict
):
for
k
in
self
.
cmap
.
keys
():
self
.
cmap
.
pop
(
k
)
# empty current dict
self
.
__init__
()
# empty current dict
for
k
in
correct_map
:
self
.
set
(
k
,
correct_map
[
k
])
# create new dict entries
else
:
self
.
cmap
=
correct_map
...
...
@@ -98,9 +104,5 @@ class CorrectMap(object):
raise
Exception
(
'CorrectMap.update called with invalid argument
%
s'
%
other_cmap
)
self
.
cmap
.
update
(
other_cmap
.
get_dict
())
__getitem__
=
cmap
.
__getitem__
__iter__
=
cmap
.
__iter__
items
=
cmap
.
items
keys
=
cmap
.
keys
common/lib/capa/responsetypes.py
View file @
8030bce0
...
...
@@ -158,6 +158,7 @@ class LoncapaResponse(object):
'''
new_cmap
=
self
.
get_score
(
student_answers
)
self
.
get_hints
(
student_answers
,
new_cmap
,
old_cmap
)
# log.debug('new_cmap = %s' % new_cmap)
return
new_cmap
def
get_hints
(
self
,
student_answers
,
new_cmap
,
old_cmap
):
...
...
@@ -492,7 +493,7 @@ def sympy_check2():
if
cfn
in
self
.
context
:
self
.
code
=
self
.
context
[
cfn
]
else
:
msg
=
"
%
s: can't find cfn
in context =
%
s"
%
(
unicode
(
self
),
self
.
context
)
msg
=
"
%
s: can't find cfn
%
s in context"
%
(
unicode
(
self
),
cfn
)
msg
+=
"
\n
See XML source line
%
s"
%
getattr
(
self
.
xml
,
'sourceline'
,
'<unavailable>'
)
raise
LoncapaProblemError
(
msg
)
...
...
@@ -896,7 +897,7 @@ class FormulaResponse(LoncapaResponse):
given
,
cs
=
self
.
case_sensitive
)
except
UndefinedVariable
as
uv
:
log
.
deb
b
ug
(
'formularesponse: undefined variable in given=
%
s'
%
given
)
log
.
debug
(
'formularesponse: undefined variable in given=
%
s'
%
given
)
raise
StudentInputError
(
uv
.
message
+
" not permitted in answer"
)
except
Exception
,
err
:
#traceback.print_exc()
...
...
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