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
eecc234b
Commit
eecc234b
authored
Oct 20, 2015
by
solashirai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed print
parent
169f86cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
8 deletions
+5
-8
crowdsourcehinter/crowdsourcehinter.py
+2
-5
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+3
-3
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
eecc234b
...
...
@@ -157,7 +157,6 @@ class CrowdsourceHinter(XBlock):
answers
=
[
a
.
split
(
'='
)
for
a
in
answers
.
split
(
"&"
)]
# Next, we decode the HTML escapes
answers
=
[(
a
[
0
],
urllib
.
unquote_plus
(
a
[
1
]))
for
a
in
answers
]
print
answers
return
dict
(
answers
)
@XBlock.json_handler
...
...
@@ -287,13 +286,12 @@ class CrowdsourceHinter(XBlock):
# for the time being only the first answer/hint pair will be shown to the studen
if
self
.
used
[
0
]
in
self
.
hint_database
[
self
.
incorrect_answers
[
0
]]:
# add new key (hint) to used_hint_answer_text with a value (incorrect answer)
used_hint_answer_text
[
self
.
used
[
0
]]
=
self
.
incorrect_answers
[
0
]
used_hint_answer_text
[
json
.
dumps
(
self
.
used
[
0
])]
=
json
.
dumps
(
self
.
incorrect_answers
[
0
])
else
:
# if the student's answer had no hints (or all the hints were reported and unavailable) return None
used_hint_answer_text
[
None
]
=
self
.
incorrect_answers
[
0
]
used_hint_answer_text
[
None
]
=
json
.
dumps
(
self
.
incorrect_answers
[
0
])
self
.
incorrect_answers
=
[]
self
.
used
=
[]
print
used_hint_answer_text
return
used_hint_answer_text
@XBlock.json_handler
...
...
@@ -359,7 +357,6 @@ class CrowdsourceHinter(XBlock):
"""
submission
=
data
[
'new_hint_submission'
]
answer
=
data
[
'answer'
]
print
answer
,
submission
# If we don't have the hint already, add it
if
submission
not
in
self
.
hint_database
[
answer
]:
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
eecc234b
...
...
@@ -145,7 +145,7 @@ function CrowdsourceHinter(runtime, element, data){
* @param student_answers is the text of the student's incorrect answer
*/
function
showStudentSubmissionHistory
(
student_answer
){
var
showStudentSubmissionTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_student_submission'
).
html
(),
{
answer
:
student_answer
}));
var
showStudentSubmissionTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_student_submission'
).
html
(),
{
answer
:
student_answer
}));
$
(
'.csh_student_submission'
,
element
).
append
(
showStudentSubmissionTemplate
);
}
...
...
@@ -169,8 +169,8 @@ function CrowdsourceHinter(runtime, element, data){
}
$
.
each
(
result
,
function
(
index
,
value
)
{
if
(
value
!=
"Reported"
){
showStudentSubmissionHistory
(
value
);
student_answer
=
encodeURI
(
value
)
;
showStudentSubmissionHistory
(
$
.
parseJSON
(
value
)
);
student_answer
=
value
;
hint
=
index
;
//hints return null if no answer-specific hints exist
if
(
hint
===
"null"
)
{
...
...
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