Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crowdsourcehinter
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
crowdsourcehinter
Commits
6a50de30
Commit
6a50de30
authored
Mar 30, 2015
by
solashirai
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typo fix
parent
0be2bc41
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
13 deletions
+9
-13
crowdsourcehinter/#crowdsourcehinter.py#
+0
-0
crowdsourcehinter/crowdsourcehinter.py
+7
-10
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+2
-3
No files found.
crowdsourcehinter/#crowdsourcehinter.py#
deleted
100644 → 0
View file @
0be2bc41
This diff is collapsed.
Click to expand it.
crowdsourcehinter/crowdsourcehinter.py
View file @
6a50de30
...
@@ -5,14 +5,11 @@ import pkg_resources
...
@@ -5,14 +5,11 @@ import pkg_resources
import
random
import
random
import
json
import
json
import
copy
import
copy
from
copy
import
deepcopy
from
xblock.core
import
XBlock
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
,
Dict
,
List
,
Boolean
,
String
from
xblock.fields
import
Scope
,
Dict
,
List
,
Boolean
,
String
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
from
eventtracking
import
tracker
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
class
CrowdsourceHinter
(
XBlock
):
class
CrowdsourceHinter
(
XBlock
):
...
@@ -60,7 +57,7 @@ class CrowdsourceHinter(XBlock):
...
@@ -60,7 +57,7 @@ class CrowdsourceHinter(XBlock):
# This string determines whether or not to show only the best (highest rated) hint to a student
# This string determines whether or not to show only the best (highest rated) hint to a student
# When set to 'True' only the best hint will be shown to the student.
# When set to 'True' only the best hint will be shown to the student.
# Details on operation when set to 'False' are to be finalized.
# Details on operation when set to 'False' are to be finalized.
show_best
=
Boolean
(
default
=
True
,
scope
=
Scope
.
user_state_summary
)
show_best
=
Boolean
(
default
=
True
,
scope
=
Scope
.
user_state_summary
)
# This String represents the xblock element for which the hinter is running. It is necessary to manually
# This String represents the xblock element for which the hinter is running. It is necessary to manually
# set this value in the XML file under the format "hinting_element": "i4x://edX/DemoX/problem/Text_Input" .
# set this value in the XML file under the format "hinting_element": "i4x://edX/DemoX/problem/Text_Input" .
# Setting the element in the XML file is critical for the hinter to work.
# Setting the element in the XML file is critical for the hinter to work.
...
@@ -238,21 +235,21 @@ class CrowdsourceHinter(XBlock):
...
@@ -238,21 +235,21 @@ class CrowdsourceHinter(XBlock):
if
str
(
hints
)
==
reported_hints
:
if
str
(
hints
)
==
reported_hints
:
feedback_data
[
str
(
hints
)]
=
str
(
"Reported"
)
feedback_data
[
str
(
hints
)]
=
str
(
"Reported"
)
if
len
(
self
.
WrongAnswers
)
==
0
:
if
len
(
self
.
WrongAnswers
)
==
0
:
return
return
feedback_data
else
:
else
:
for
index
in
range
(
0
,
len
(
self
.
Used
)):
for
index
in
range
(
0
,
len
(
self
.
Used
)):
# each index is a hint that was used, in order of usage
# each index is a hint that was used, in order of usage
if
str
(
self
.
Used
[
index
])
in
self
.
hint_database
[
self
.
WrongAnswers
[
index
]]:
if
str
(
self
.
Used
[
index
])
in
self
.
hint_database
[
self
.
WrongAnswers
[
index
]]:
# add new key (hint) to feedback_data with a value (incorrect answer)
# add new key (hint) to feedback_data with a value (incorrect answer)
feedback_data
[
str
(
self
.
Used
[
index
])]
=
str
(
self
.
WrongAnswers
[
index
])
feedback_data
[
str
(
self
.
Used
[
index
])]
=
str
(
self
.
WrongAnswers
[
index
])
self
.
WrongAnswers
=
[]
self
.
WrongAnswers
=
[]
self
.
Used
=
[]
self
.
Used
=
[]
return
feedback_data
return
feedback_data
else
:
else
:
# if the student's answer had no hints (or all the hints were reported and unavailable) return None
# if the student's answer had no hints (or all the hints were reported and unavailable) return None
feedback_data
[
None
]
=
str
(
self
.
WrongAnswers
[
index
])
feedback_data
[
None
]
=
str
(
self
.
WrongAnswers
[
index
])
self
.
WrongAnswers
=
[]
self
.
WrongAnswers
=
[]
self
.
Used
=
[]
self
.
Used
=
[]
return
feedback_data
return
feedback_data
self
.
WrongAnswers
=
[]
self
.
WrongAnswers
=
[]
self
.
Used
=
[]
self
.
Used
=
[]
...
@@ -307,7 +304,7 @@ class CrowdsourceHinter(XBlock):
...
@@ -307,7 +304,7 @@ class CrowdsourceHinter(XBlock):
data_rating
=
data
[
'student_rating'
]
data_rating
=
data
[
'student_rating'
]
data_hint
=
data
[
'hint'
]
data_hint
=
data
[
'hint'
]
if
data
[
'student_rating'
]
==
'unreport'
:
if
data
[
'student_rating'
]
==
'unreport'
:
for
reported
ed
_hints
in
self
.
Reported
:
for
reported_hints
in
self
.
Reported
:
if
reported_hints
==
data_hint
:
if
reported_hints
==
data_hint
:
self
.
Reported
.
pop
(
data_hint
,
None
)
self
.
Reported
.
pop
(
data_hint
,
None
)
return
{
'rating'
:
'unreported'
}
return
{
'rating'
:
'unreported'
}
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
6a50de30
...
@@ -194,7 +194,7 @@ function CrowdsourceHinter(runtime, element, data){
...
@@ -194,7 +194,7 @@ function CrowdsourceHinter(runtime, element, data){
$
(
element
).
on
(
'click'
,
'.csh_submit_new'
,
function
(){
$
(
element
).
on
(
'click'
,
'.csh_submit_new'
,
function
(){
//Click event to submit a new hint for an answer.
//Click event to submit a new hint for an answer.
if
(
$
(
this
).
parent
().
parent
().
find
(
'.csh_student_text_input'
).
val
()
!=
null
){
if
(
$
(
this
).
parent
().
parent
().
find
(
'.csh_student_text_input'
).
val
()
.
length
>
0
){
var
answerdata
=
unescape
(
$
(
this
).
attr
(
'answer'
));
var
answerdata
=
unescape
(
$
(
this
).
attr
(
'answer'
));
var
newhint
=
unescape
(
$
(
'.csh_student_text_input'
).
val
());
var
newhint
=
unescape
(
$
(
'.csh_student_text_input'
).
val
());
Logger
.
log
(
'crowd_hinter.submit_new.click.event'
,
{
"student_answer"
:
answerdata
,
"new_hint_submission"
:
newhint
});
Logger
.
log
(
'crowd_hinter.submit_new.click.event'
,
{
"student_answer"
:
answerdata
,
"new_hint_submission"
:
newhint
});
...
@@ -227,8 +227,7 @@ function CrowdsourceHinter(runtime, element, data){
...
@@ -227,8 +227,7 @@ function CrowdsourceHinter(runtime, element, data){
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'rate_hint'
),
url
:
runtime
.
handlerUrl
(
element
,
'rate_hint'
),
data
:
JSON
.
stringify
({
"student_rating"
:
$
(
this
).
attr
(
'data-rate'
),
"hint"
:
hint
,
"student_answer"
:
student_answer
}),
data
:
JSON
.
stringify
({
"student_rating"
:
$
(
this
).
attr
(
'data-rate'
),
"hint"
:
hint
,
"student_answer"
:
student_answer
})
success
:
console
.
log
(
$
(
this
).
attr
(
'data-rate'
))
});
});
});
});
...
...
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