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
668062a1
Commit
668062a1
authored
May 11, 2012
by
Isaac Chuang
Committed by
Piotr Mitros
May 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor cleanups to capa_module (comments, formatting, etc.)
parent
577d8815
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
djangoapps/courseware/modules/capa_module.py
+12
-2
No files found.
djangoapps/courseware/modules/capa_module.py
View file @
668062a1
...
...
@@ -196,6 +196,9 @@ class Module(XModule):
self
.
lcp
=
LoncapaProblem
(
self
.
filestore
.
open
(
self
.
filename
),
self
.
item_id
,
state
,
seed
=
seed
)
def
handle_ajax
(
self
,
dispatch
,
get
):
'''
This is called by courseware.module_render, to handle an AJAX call. "get" is request.POST
'''
if
dispatch
==
'problem_get'
:
response
=
self
.
get_problem
(
get
)
elif
False
:
#self.close_date >
...
...
@@ -246,10 +249,16 @@ class Module(XModule):
raise
self
.
system
.
exception404
#TODO: Not 404
def
get_answer
(
self
,
get
):
'''
For the "show answer" button.
TODO: show answer events should be logged here, not just in the problem.js
'''
if
not
self
.
answer_available
():
raise
self
.
system
.
exception404
else
:
return
json
.
dumps
(
self
.
lcp
.
get_question_answers
(),
answers
=
self
.
lcp
.
get_question_answers
()
return
json
.
dumps
(
answers
,
cls
=
ComplexEncoder
)
# Figure out if we should move these to capa_problem?
...
...
@@ -265,6 +274,7 @@ class Module(XModule):
event_info
[
'state'
]
=
self
.
lcp
.
get_state
()
event_info
[
'filename'
]
=
self
.
filename
# make a dict of all the student responses ("answers").
answers
=
dict
()
# input_resistor_1 ==> resistor_1
for
key
in
get
:
...
...
@@ -299,7 +309,6 @@ class Module(XModule):
raise
return
json
.
dumps
({
'success'
:
'Unknown Error'
})
self
.
attempts
=
self
.
attempts
+
1
self
.
lcp
.
done
=
True
...
...
@@ -371,6 +380,7 @@ class Module(XModule):
self
.
lcp
.
context
=
dict
()
self
.
lcp
.
questions
=
dict
()
# Detailed info about questions in problem instance. TODO: Should be by id and not lid.
self
.
lcp
.
seed
=
None
self
.
lcp
=
LoncapaProblem
(
self
.
filestore
.
open
(
self
.
filename
),
self
.
item_id
,
self
.
lcp
.
get_state
())
event_info
[
'new_state'
]
=
self
.
lcp
.
get_state
()
...
...
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