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
d009181d
Commit
d009181d
authored
Mar 29, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with showing answers related to complex numbers
parent
ec1d6d34
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
djangoapps/courseware/capa/responsetypes.py
+0
-1
djangoapps/courseware/modules/capa_module.py
+8
-1
No files found.
djangoapps/courseware/capa/responsetypes.py
View file @
d009181d
...
@@ -38,7 +38,6 @@ class numericalresponse(object):
...
@@ -38,7 +38,6 @@ class numericalresponse(object):
def
__init__
(
self
,
xml
,
context
):
def
__init__
(
self
,
xml
,
context
):
self
.
xml
=
xml
self
.
xml
=
xml
self
.
correct_answer
=
contextualize_text
(
xml
.
get
(
'answer'
),
context
)
self
.
correct_answer
=
contextualize_text
(
xml
.
get
(
'answer'
),
context
)
self
.
correct_answer
=
complex
(
self
.
correct_answer
)
self
.
tolerance_xml
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
self
.
tolerance_xml
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
id
=
xml
.
get
(
'id'
))[
0
]
id
=
xml
.
get
(
'id'
))[
0
]
self
.
tolerance
=
contextualize_text
(
self
.
tolerance_xml
,
context
)
self
.
tolerance
=
contextualize_text
(
self
.
tolerance_xml
,
context
)
...
...
djangoapps/courseware/modules/capa_module.py
View file @
d009181d
...
@@ -26,6 +26,12 @@ import courseware.content_parser as content_parser
...
@@ -26,6 +26,12 @@ import courseware.content_parser as content_parser
log
=
logging
.
getLogger
(
"mitx.courseware"
)
log
=
logging
.
getLogger
(
"mitx.courseware"
)
class
ComplexEncoder
(
json
.
JSONEncoder
):
def
default
(
self
,
obj
):
if
isinstance
(
obj
,
complex
):
return
"{real:.7g}{imag:+.7g}*j"
.
format
(
real
=
obj
.
real
,
imag
=
obj
.
imag
)
return
json
.
JSONEncoder
.
default
(
self
,
obj
)
class
Module
(
XModule
):
class
Module
(
XModule
):
''' Interface between capa_problem and x_module. Originally a hack
''' Interface between capa_problem and x_module. Originally a hack
meant to be refactored out, but it seems to be serving a useful
meant to be refactored out, but it seems to be serving a useful
...
@@ -240,7 +246,8 @@ class Module(XModule):
...
@@ -240,7 +246,8 @@ class Module(XModule):
if
not
self
.
answer_available
():
if
not
self
.
answer_available
():
raise
Http404
raise
Http404
else
:
else
:
return
json
.
dumps
(
self
.
lcp
.
get_question_answers
())
return
json
.
dumps
(
self
.
lcp
.
get_question_answers
(),
cls
=
ComplexEncoder
)
# Figure out if we should move these to capa_problem?
# Figure out if we should move these to capa_problem?
...
...
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