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
80afc470
Commit
80afc470
authored
May 01, 2015
by
solashirai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed unused funcitonality, fixed naming
parent
e9a57f8d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
crowdsourcehinter/crowdsourcehinter.py
+0
-0
crowdsourcehinter/static/html/crowdsourcehinter.html
+1
-1
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+18
-18
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
80afc470
This diff is collapsed.
Click to expand it.
crowdsourcehinter/static/html/crowdsourcehinter.html
View file @
80afc470
<script
type=
'x-tmpl/mustache'
id=
'show_hint_
contribution
'
>
<script
type=
'x-tmpl/mustache'
id=
'show_hint_
rating_ux
'
>
<
div
class
=
'csh_hint_value'
value
=
"{{hintText}}"
>
<
div
class
=
'csh_hint_data'
>
<
div
class
=
"csh_hint"
><
b
>
{{
hintText
}}
<
/b></
div
>
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
80afc470
...
...
@@ -37,21 +37,21 @@ function CrowdsourceHinter(runtime, element, data){
}
/**
* Start student hint contribution. This will allow students to contribute new hints
* Start student hint
rating/
contribution. This will allow students to contribute new hints
* to the hinter as well as vote on the helpfulness of the first hint they received
* for the current problem. This function is called after the student answers
* the question correctly.
*/
function
startHint
Contribution
(){
function
startHint
Rating
(){
$
(
'.csh_correct'
,
element
).
show
();
$
(
".csh_hint_reveal"
,
element
).
hide
();
if
(
$
(
'.csh_hint_creation'
,
element
)){
//send empty data for ajax call because not having a data field causes error
$
.
ajax
({
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'get_
feedback
'
),
url
:
runtime
.
handlerUrl
(
element
,
'get_
used_hint_answer_data
'
),
data
:
JSON
.
stringify
({}),
success
:
setHint
ContributionDivs
success
:
setHint
RatingUX
});
}
}
...
...
@@ -60,6 +60,7 @@ function CrowdsourceHinter(runtime, element, data){
* Check whether or not the question was correctly answered by the student.
* The current method of checking the correctness of the answer is very brittle
* since we simply look for a string within the problemGradedEventData.
* HACK
* @param problemGradedEventData is the data from problem_graded event.
*/
function
checkIsAnswerCorrect
(
problemGradedEventData
){
...
...
@@ -80,7 +81,7 @@ function CrowdsourceHinter(runtime, element, data){
//search method of correctness of problem is brittle due to checking for a class within
//the problem block.
if
(
checkIsAnswerCorrect
(
data
)){
startHint
Contribution
();
startHint
Rating
();
}
else
{
//if the submitted answer is incorrect
getHint
(
data
);
}
...
...
@@ -98,15 +99,15 @@ function CrowdsourceHinter(runtime, element, data){
}
/**
* Called by setHint
ContributionDivs
to append hints into divs created by
* Called by setHint
RatingUX
to append hints into divs created by
* showStudentSubmissoinHistory, after the student answered the question correctly.
* Feedback on hints at this stage consists of upvote/downvote/report buttons.
* @param hint is the first hint that was shown to the student
* @param student_answer is the first incorrect answer submitted by the student
*/
function
showStudentHint
Contribution
(
hint
,
student_answer
){
var
hint
ContributionTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_hint_contribution
'
).
html
(),
{
hintText
:
hint
}));
$
(
'.csh_answer_text'
,
element
).
append
(
hint
Contribution
Template
);
function
showStudentHint
RatingUX
(
hint
,
student_answer
){
var
hint
RatingUXTemplate
=
$
(
Mustache
.
render
(
$
(
'#show_hint_rating_ux
'
).
html
(),
{
hintText
:
hint
}));
$
(
'.csh_answer_text'
,
element
).
append
(
hint
RatingUX
Template
);
var
hintCreationTemplate
=
$
(
Mustache
.
render
(
$
(
'#add_hint_creation'
).
html
(),
{}));
$
(
'.csh_answer_text'
,
element
).
append
(
hintCreationTemplate
);
}
...
...
@@ -125,8 +126,8 @@ function CrowdsourceHinter(runtime, element, data){
/**
* Append new divisions into html for each answer the student submitted before correctly
* answering the question. showStudentHint
Contribution
appends new hints into these divs.
*
When the hinter is set to show best, only one div will be created.
* answering the question. showStudentHint
RatingUX
appends new hints into these divs.
*
* @param student_answers is the text of the student's incorrect answer
*/
function
showStudentSubmissionHistory
(
student_answer
){
...
...
@@ -138,11 +139,11 @@ function CrowdsourceHinter(runtime, element, data){
* Set up student/staff voting on hints and contribution of new hints. The original incorrect answer and the
* the corresponding hint shown to the student is displayed. Students can upvote/downvote/report
* the hint or contribute a new hint for their incorrect answer.
*
Only one incorrect answer and hint will be shown when the hinter is set to show best.
*
* @param result is a dictionary of incorrect answers and hints, with the index being the hint and the value
* being the incorrect answer
*/
function
setHint
ContributionDivs
(
result
){
function
setHint
RatingUX
(
result
){
if
(
data
.
isStaff
){
//allow staff to see and remove/return reported hints to/from the hint pool for a problem
$
(
'.crowdsourcehinter_block'
,
element
).
attr
(
'class'
,
'crowdsourcehinter_block_is_staff'
);
$
.
each
(
result
,
function
(
index
,
value
)
{
...
...
@@ -164,7 +165,7 @@ function CrowdsourceHinter(runtime, element, data){
var
hintCreationTemplate
=
$
(
Mustache
.
render
(
$
(
'#add_hint_creation'
).
html
(),
{}));
$
(
'.csh_student_answer'
,
element
).
append
(
hintCreationTemplate
);
}
else
{
showStudentHint
Contribution
(
hint
,
student_answer
);
showStudentHint
RatingUX
(
hint
,
student_answer
);
}
}
});
...
...
@@ -175,7 +176,7 @@ function CrowdsourceHinter(runtime, element, data){
* is triggered by clicking the "contribute a new hint" button.
* @param createTextInputButtonHTML is the "contribute a new hint" button that was clicked
*/
function
create
_text_i
nput
(){
return
function
(
createTextInputButtonHTML
){
function
create
HintContributionTextI
nput
(){
return
function
(
createTextInputButtonHTML
){
$
(
'.csh_student_hint_creation'
,
element
).
each
(
function
(){
$
(
createTextInputButtonHTML
.
currentTarget
).
show
();
});
...
...
@@ -187,11 +188,11 @@ function CrowdsourceHinter(runtime, element, data){
var
hintTextInputTemplate
=
$
(
Mustache
.
render
(
$
(
'#hint_text_input'
).
html
(),
{
student_answer
:
student_answer
}));
$
(
'.csh_answer_text'
,
element
).
append
(
hintTextInputTemplate
);
}}
$
(
element
).
on
(
'click'
,
'.csh_student_hint_creation'
,
create
_text_i
nput
(
$
(
this
)));
$
(
element
).
on
(
'click'
,
'.csh_student_hint_creation'
,
create
HintContributionTextI
nput
(
$
(
this
)));
/**
* Submit a new hint created by the student to the hint pool. Hint text is in
* the text input area created by create
_text_i
nput. Contributed hints are specific to
* the text input area created by create
HintContributionTextI
nput. Contributed hints are specific to
* incorrect answers. Triggered by clicking the "submit hint" button.
* @param submitHintButtonHTML is the "submit hint" button clicked
*/
...
...
@@ -258,7 +259,6 @@ function CrowdsourceHinter(runtime, element, data){
*/
function
removeReportedHint
(){
Logger
.
log
(
'crowd_hinter.staff_rate_hint.click.event'
,
{
"hint"
:
hint
,
"student_answer"
:
student_answer
,
"rating"
:
rating
});
//TODO: change if statement, just find .csh_hint_value with attribute of hint
$
(
".csh_hint_value[value='"
+
hint
+
"']"
,
element
).
remove
();
}
...
...
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