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
595f6a2f
Commit
595f6a2f
authored
Aug 29, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70 from dragonfi/assessment-event-tracking
Assessment event tracking
parents
115817e9
a7c7b0e5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
16 deletions
+50
-16
mentoring/mentoring.py
+15
-14
mentoring/public/js/mentoring_assessment_view.js
+4
-0
mentoring/templates/xml/mentoring_assessment.xml
+28
-0
mentoring/utils.py
+3
-2
No files found.
mentoring/mentoring.py
View file @
595f6a2f
...
...
@@ -76,7 +76,7 @@ class MentoringBlock(XBlockWithLightChildren):
default
=
0
,
scope
=
Scope
.
user_state
,
enforce_type
=
True
)
max_attempts
=
Integer
(
help
=
"Number of max attempts for this questions"
,
default
=
0
,
scope
=
Scope
.
content
,
enforce_type
=
True
)
mode
=
String
(
help
=
"Mode of the mentoring. 'standard' or 'a
cc
essment'"
,
mode
=
String
(
help
=
"Mode of the mentoring. 'standard' or 'a
ss
essment'"
,
default
=
'standard'
,
scope
=
Scope
.
content
)
step
=
Integer
(
help
=
"Keep track of the student assessment progress."
,
default
=
0
,
scope
=
Scope
.
user_state
,
enforce_type
=
True
)
...
...
@@ -145,26 +145,20 @@ class MentoringBlock(XBlockWithLightChildren):
@XBlock.json_handler
def
publish_event
(
self
,
data
,
suffix
=
''
):
try
:
event_type
=
data
.
pop
(
'event_type'
)
except
KeyError
as
e
:
return
{
'result'
:
'error'
,
'message'
:
'Missing event_type in JSON data'
}
self
.
_publish_event
(
event_type
,
data
)
def
_publish_event
(
self
,
event_type
,
data
):
data
[
'user_id'
]
=
self
.
scope_ids
.
user_id
data
[
'component_id'
]
=
self
.
_get_unique_id
()
data
[
'component_id'
]
=
self
.
url_name
self
.
runtime
.
publish
(
self
,
event_type
,
data
)
return
{
'result'
:
'success'
}
def
_get_unique_id
(
self
):
try
:
unique_id
=
self
.
location
.
name
except
AttributeError
:
# workaround for xblock workbench
unique_id
=
self
.
parent
.
replace
(
'.'
,
'-'
)
return
unique_id
@property
def
title
(
self
):
"""
...
...
@@ -251,9 +245,7 @@ class MentoringBlock(XBlockWithLightChildren):
raw_score
=
self
.
score
[
0
]
self
.
runtime
.
publish
(
self
,
'xblock.mentoring.submitted'
,
{
'user_id'
:
self
.
scope_ids
.
user_id
,
'component_id'
:
self
.
_get_unique_id
(),
self
.
_publish_event
(
'xblock.mentoring.submitted'
,
{
'num_attempts'
:
self
.
num_attempts
,
'submitted_answer'
:
submissions
,
'grade'
:
raw_score
,
...
...
@@ -297,6 +289,8 @@ class MentoringBlock(XBlockWithLightChildren):
child
.
save
()
completed
=
child_result
[
'completed'
]
event_data
=
{}
(
raw_score
,
score
,
correct
,
incorrect
)
=
self
.
score
if
current_child
==
self
.
steps
[
-
1
]:
log
.
info
(
u'Last assessment step submitted: {}'
.
format
(
submissions
))
...
...
@@ -306,10 +300,17 @@ class MentoringBlock(XBlockWithLightChildren):
'max_value'
:
1
,
'score_type'
:
'proficiency'
,
})
event_data
[
'final_grade'
]
=
raw_score
self
.
num_attempts
+=
1
self
.
completed
=
True
event_data
[
'exercise_id'
]
=
current_child
.
name
event_data
[
'num_attempts'
]
=
self
.
num_attempts
event_data
[
'submitted_answer'
]
=
submissions
self
.
_publish_event
(
'xblock.mentoring.assessment.submitted'
,
event_data
)
return
{
'completed'
:
completed
,
'attempted'
:
self
.
attempted
,
...
...
mentoring/public/js/mentoring_assessment_view.js
View file @
595f6a2f
...
...
@@ -99,6 +99,10 @@ function MentoringAssessmentView(runtime, element, mentoring) {
++
active_child
;
while
(
1
)
{
var
child
=
mentoring
.
displayChild
(
active_child
,
options
);
mentoring
.
publish_event
({
event_type
:
'xblock.mentoring.assessment.shown'
,
exercise_id
:
$
(
child
).
attr
(
'name'
)
});
if
((
typeof
child
!==
'undefined'
)
||
active_child
==
mentoring
.
children
.
length
-
1
)
break
;
++
active_child
;
...
...
mentoring/templates/xml/mentoring_assessment.xml
0 → 100644
View file @
595f6a2f
<mentoring
url_name=
"{{ url_name }}"
display_name=
"Nav tooltip title"
weight=
"1"
mode=
"assessment"
>
<title>
Default Title
</title>
<html>
<p>
What is your goal?
</p>
</html>
<answer
name=
"goal"
/>
<mcq
name=
"mcq_1_1"
type=
"choices"
>
<question>
Do you like this MCQ?
</question>
<choice
value=
"yes"
>
Yes
</choice>
<choice
value=
"maybenot"
>
Maybe not
</choice>
<choice
value=
"understand"
>
I don't understand
</choice>
</mcq>
<mcq
name=
"mcq_1_2"
type=
"rating"
low=
"Not good at all"
high=
"Extremely good"
>
<question>
How much do you rate this MCQ?
</question>
<choice
value=
"notwant"
>
I don't want to rate it
</choice>
</mcq>
<mrq
name=
"mrq_1_1"
type=
"choices"
>
<question>
What do you like in this MRQ?
</question>
<choice
value=
"elegance"
>
Its elegance
</choice>
<choice
value=
"beauty"
>
Its beauty
</choice>
<choice
value=
"gracefulness"
>
Its gracefulness
</choice>
<choice
value=
"bugs"
>
Its bugs
</choice>
</mrq>
</mentoring>
mentoring/utils.py
View file @
595f6a2f
...
...
@@ -94,10 +94,11 @@ def get_scenarios_from_path(scenarios_path, include_identifier=False):
identifier
=
template
[:
-
4
]
title
=
identifier
.
replace
(
'_'
,
' '
)
.
title
()
template_path
=
os
.
path
.
join
(
scenarios_path
,
template
)
scenario
=
unicode
(
render_template
(
template_path
,
{
"url_name"
:
identifier
}))
if
not
include_identifier
:
scenarios
.
append
((
title
,
load_resource
(
template_path
)
))
scenarios
.
append
((
title
,
scenario
))
else
:
scenarios
.
append
((
identifier
,
title
,
load_resource
(
template_path
)
))
scenarios
.
append
((
identifier
,
title
,
scenario
))
return
scenarios
...
...
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