Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
522da359
Commit
522da359
authored
Mar 25, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lightchild data loading
parent
125eeb30
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
mentoring/html.py
+1
-1
mentoring/light_children.py
+3
-3
mentoring/mrq.py
+2
-0
mentoring/questionnaire.py
+4
-0
No files found.
mentoring/html.py
View file @
522da359
...
@@ -56,7 +56,7 @@ class HTMLBlock(LightChild):
...
@@ -56,7 +56,7 @@ class HTMLBlock(LightChild):
return
block
return
block
def
student_view
(
self
,
context
=
None
):
def
student_view
(
self
,
context
=
None
):
#
HACK, TO MODIFY
#
TODO HACK, TO MODIFY, SHOULDN'T USE A get() METHOD
return
Fragment
(
self
.
content
.
get
())
return
Fragment
(
self
.
content
.
get
())
def
mentoring_view
(
self
,
context
=
None
):
def
mentoring_view
(
self
,
context
=
None
):
...
...
mentoring/light_children.py
View file @
522da359
...
@@ -209,8 +209,6 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -209,8 +209,6 @@ class LightChild(Plugin, LightChildrenMixin):
def
__init__
(
self
,
parent
):
def
__init__
(
self
,
parent
):
self
.
parent
=
parent
self
.
parent
=
parent
self
.
xblock_container
=
parent
.
xblock_container
self
.
xblock_container
=
parent
.
xblock_container
# This doesn't work, crash.... where should I trigger the lazy property to be loaded?
#self.load_student_data()
def
__setattr__
(
self
,
name
,
value
):
def
__setattr__
(
self
,
name
,
value
):
...
@@ -255,8 +253,10 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -255,8 +253,10 @@ class LightChild(Plugin, LightChildrenMixin):
"""
"""
Load the values from the student_data in the database.
Load the values from the student_data in the database.
"""
"""
if
not
self
.
student_data
:
return
student_data
=
self
.
student_data
student_data
=
json
.
loads
(
self
.
student_data
)
fields
=
self
.
get_fields
()
fields
=
self
.
get_fields
()
for
field
in
fields
:
for
field
in
fields
:
if
field
in
student_data
:
if
field
in
student_data
:
...
...
mentoring/mrq.py
View file @
522da359
...
@@ -46,12 +46,14 @@ class MRQBlock(QuestionnaireAbstractBlock):
...
@@ -46,12 +46,14 @@ class MRQBlock(QuestionnaireAbstractBlock):
max_attempts
=
Integer
(
help
=
"Number of max attempts for this questions"
,
default
=
None
,
scope
=
Scope
.
content
)
max_attempts
=
Integer
(
help
=
"Number of max attempts for this questions"
,
default
=
None
,
scope
=
Scope
.
content
)
num_attempts
=
Integer
(
help
=
"Number of attempts a user has answered for this questions"
,
scope
=
Scope
.
user_state
)
num_attempts
=
Integer
(
help
=
"Number of attempts a user has answered for this questions"
,
scope
=
Scope
.
user_state
)
# TODO REMOVE THIS, ONLY NEEDED FOR LIGHTCHILDREN
@classmethod
@classmethod
def
get_fields
(
cls
):
def
get_fields
(
cls
):
return
[
return
[
'num_attempts'
'num_attempts'
]
]
# TODO REMOVE ALL USE OF THE get() METHOD
def
submit
(
self
,
submissions
):
def
submit
(
self
,
submissions
):
log
.
debug
(
u'Received MRQ submissions: "
%
s"'
,
submissions
)
log
.
debug
(
u'Received MRQ submissions: "
%
s"'
,
submissions
)
...
...
mentoring/questionnaire.py
View file @
522da359
...
@@ -73,6 +73,10 @@ class QuestionnaireAbstractBlock(LightChild):
...
@@ -73,6 +73,10 @@ class QuestionnaireAbstractBlock(LightChild):
def
mentoring_view
(
self
,
context
=
None
):
def
mentoring_view
(
self
,
context
=
None
):
name
=
self
.
__class__
.
__name__
name
=
self
.
__class__
.
__name__
# Ensure our data are loaded from the db
# TODO HACK, TO REMOVE.
self
.
load_student_data
()
if
str
(
self
.
type
)
not
in
self
.
valid_types
:
if
str
(
self
.
type
)
not
in
self
.
valid_types
:
raise
ValueError
,
u'Invalid value for {}.type: `{}`'
.
format
(
name
,
self
.
type
)
raise
ValueError
,
u'Invalid value for {}.type: `{}`'
.
format
(
name
,
self
.
type
)
...
...
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