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
cb899cb7
Commit
cb899cb7
authored
Apr 05, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11 from FiloSottile/grading
Add grading capabilities to mentoring blocks
parents
544ccade
ff373b3a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
2 deletions
+13
-2
mentoring/answer.py
+1
-0
mentoring/mcq.py
+1
-0
mentoring/mentoring.py
+9
-1
mentoring/mrq.py
+2
-1
No files found.
mentoring/answer.py
View file @
cb899cb7
...
@@ -104,6 +104,7 @@ class AnswerBlock(LightChild):
...
@@ -104,6 +104,7 @@ class AnswerBlock(LightChild):
return
{
return
{
'student_input'
:
self
.
student_input
,
'student_input'
:
self
.
student_input
,
'completed'
:
self
.
completed
,
'completed'
:
self
.
completed
,
'score'
:
1
if
self
.
completed
else
0
,
}
}
@property
@property
...
...
mentoring/mcq.py
View file @
cb899cb7
...
@@ -81,6 +81,7 @@ class MCQBlock(QuestionnaireAbstractBlock):
...
@@ -81,6 +81,7 @@ class MCQBlock(QuestionnaireAbstractBlock):
'submission'
:
submission
,
'submission'
:
submission
,
'completed'
:
completed
,
'completed'
:
completed
,
'tips'
:
tips
,
'tips'
:
tips
,
'score'
:
1
if
completed
else
0
,
}
}
log
.
debug
(
u'MCQ submission result:
%
s'
,
result
)
log
.
debug
(
u'MCQ submission result:
%
s'
,
result
)
return
result
return
result
...
...
mentoring/mentoring.py
View file @
cb899cb7
...
@@ -30,7 +30,7 @@ from lxml import etree
...
@@ -30,7 +30,7 @@ from lxml import etree
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
xblock.core
import
XBlock
from
xblock.core
import
XBlock
from
xblock.fields
import
Boolean
,
Scope
,
String
from
xblock.fields
import
Boolean
,
Scope
,
String
,
Float
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
from
.light_children
import
XBlockWithLightChildren
from
.light_children
import
XBlockWithLightChildren
...
@@ -68,7 +68,9 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -68,7 +68,9 @@ class MentoringBlock(XBlockWithLightChildren):
default
=
False
,
scope
=
Scope
.
content
)
default
=
False
,
scope
=
Scope
.
content
)
display_submit
=
Boolean
(
help
=
"Allow to submit current block?"
,
default
=
True
,
scope
=
Scope
.
content
)
display_submit
=
Boolean
(
help
=
"Allow to submit current block?"
,
default
=
True
,
scope
=
Scope
.
content
)
xml_content
=
String
(
help
=
"XML content"
,
default
=
''
,
scope
=
Scope
.
content
)
xml_content
=
String
(
help
=
"XML content"
,
default
=
''
,
scope
=
Scope
.
content
)
weight
=
Float
(
help
=
"Defines the maximum total grade of the block."
,
default
=
0
,
scope
=
Scope
.
content
)
icon_class
=
'problem'
icon_class
=
'problem'
has_score
=
True
def
student_view
(
self
,
context
):
def
student_view
(
self
,
context
):
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_view'
,
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_view'
,
...
@@ -136,6 +138,12 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -136,6 +138,12 @@ class MentoringBlock(XBlockWithLightChildren):
elif
completed
and
self
.
next_step
==
self
.
url_name
:
elif
completed
and
self
.
next_step
==
self
.
url_name
:
self
.
next_step
=
self
.
followed_by
self
.
next_step
=
self
.
followed_by
score
=
sum
(
r
[
1
][
'score'
]
for
r
in
submit_results
)
/
float
(
len
(
submit_results
))
self
.
runtime
.
publish
(
self
,
'grade'
,
{
'value'
:
score
,
'max_value'
:
1
,
})
self
.
completed
=
bool
(
completed
)
self
.
completed
=
bool
(
completed
)
return
{
return
{
'submitResults'
:
submit_results
,
'submitResults'
:
submit_results
,
...
...
mentoring/mrq.py
View file @
cb899cb7
...
@@ -103,7 +103,8 @@ class MRQBlock(QuestionnaireAbstractBlock):
...
@@ -103,7 +103,8 @@ class MRQBlock(QuestionnaireAbstractBlock):
'choices'
:
results
,
'choices'
:
results
,
'message'
:
self
.
message
,
'message'
:
self
.
message
,
'max_attempts'
:
self
.
max_attempts
,
'max_attempts'
:
self
.
max_attempts
,
'num_attempts'
:
self
.
num_attempts
'num_attempts'
:
self
.
num_attempts
,
'score'
:
sum
(
1.0
for
r
in
results
if
r
[
'completed'
])
/
len
(
results
),
}
}
log
.
debug
(
u'MRQ submissions result:
%
s'
,
result
)
log
.
debug
(
u'MRQ submissions result:
%
s'
,
result
)
...
...
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