Commit 24119b73 by solashirai Committed by Piotr Mitros

milestone

parent a7e3b2d4
...@@ -122,7 +122,7 @@ class CrowdsourceHinter(XBlock): ...@@ -122,7 +122,7 @@ class CrowdsourceHinter(XBlock):
# the string returned by the event problem_graded is very messy and is different # the string returned by the event problem_graded is very messy and is different
# for each problem, but after all of the numbers/letters there is an equal sign, after which the # for each problem, but after all of the numbers/letters there is an equal sign, after which the
# student's input is shown. I use the function below to remove everything before the first equal # student's input is shown. I use the function below to remove everything before the first equal
# sign and only take the student's actual input. # sign and only take the student's actual input. This is not very clean.
if "=" in answer: if "=" in answer:
if found_equal_sign == 0: if found_equal_sign == 0:
found_equal_sign = 1 found_equal_sign = 1
...@@ -166,7 +166,7 @@ class CrowdsourceHinter(XBlock): ...@@ -166,7 +166,7 @@ class CrowdsourceHinter(XBlock):
self.Used.append(str("There are no hints for" + " " + answer)) self.Used.append(str("There are no hints for" + " " + answer))
return {'HintsToUse': "Sorry, there are no more hints for this answer."} return {'HintsToUse': "Sorry, there are no more hints for this answer."}
self.Used.append(not_used) self.Used.append(not_used)
return {'HintsToUse': not_used} return {'HintsToUse': not_used, "StudentAnswer": answer}
def find_hints(self, answer): def find_hints(self, answer):
""" """
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
.csh_hint_value{ .csh_hint_value{
display: flex; display: flex;
margin-left: 10px; margin-left: 10px;
/*column-count: 2;*/
} }
.csh_rating_data{ .csh_rating_data{
...@@ -26,6 +25,11 @@ ...@@ -26,6 +25,11 @@
background-color: #FF8; background-color: #FF8;
} }
.csh_hint_reveal{
display: flex;
flex-direction: row;
}
.csh_hint_data{ .csh_hint_data{
justify-content: center; justify-content: center;
width: 97%; width: 97%;
...@@ -40,7 +44,6 @@ ...@@ -40,7 +44,6 @@
} }
div[data-rate="flag"]{ div[data-rate="flag"]{
text-align: right;
align-self: flex-end; align-self: flex-end;
} }
......
...@@ -53,10 +53,9 @@ ...@@ -53,10 +53,9 @@
<div class="crowdsourcehinter_block"> <div class="crowdsourcehinter_block">
<p>
<div class='csh_hint_reveal'> <div class='csh_hint_reveal'>
<div> <div>
<span class='csh_HintsToUse'></span> <span class='csh_HintsToUse' student_answer = ''></span>
</div> </div>
<div> <div>
<div role="button" class="csh_rate_hint" data-rate="upvote" data-icon="arrow-u" aria-label="upvote"> <div role="button" class="csh_rate_hint" data-rate="upvote" data-icon="arrow-u" aria-label="upvote">
...@@ -69,8 +68,8 @@ ...@@ -69,8 +68,8 @@
<b></b> <b></b>
</div> </div>
</div> </div>
<div> </div>
</sp>
<div class="crowdsourcehinter_block"> <div class="crowdsourcehinter_block">
......
...@@ -68,6 +68,8 @@ function CrowdsourceHinter(runtime, element){ ...@@ -68,6 +68,8 @@ function CrowdsourceHinter(runtime, element){
function seehint(result){ function seehint(result){
//Show a hint to the student after an incorrect answer is submitted. //Show a hint to the student after an incorrect answer is submitted.
console.log(result.StudentAnswer);
$('.csh_HintsToUse', element).attr('student_answer', result.StudentAnswer);
$('.csh_HintsToUse', element).text(result.HintsToUse); $('.csh_HintsToUse', element).text(result.HintsToUse);
} }
...@@ -220,6 +222,16 @@ function CrowdsourceHinter(runtime, element){ ...@@ -220,6 +222,16 @@ function CrowdsourceHinter(runtime, element){
}) })
$(element).on('click', '.csh_rate_hint', function(){ $(element).on('click', '.csh_rate_hint', function(){
hint = $('.csh_HintsToUse', element).text();
student_answer = $('.csh_HintsToUse', element).attr('student_answer');
Logger.log('crowd_hinter.rate_hint.click.event', {"hint": hint, "student_answer": student_answer, "rating": $(this).attr('data-rate')});
console.log(hint);
console.log(student_answer);
});
//This version of the rate hint is currently decomissioned. This is valid if hint rating/flagging is returned
//soley to showing after the student correctly answers the question.
/* $(element).on('click', '.csh_rate_hint', function(){
//Click event to change the rating/flag a hint. The attribute 'data-rate' within each .rate_hint button is used //Click event to change the rating/flag a hint. The attribute 'data-rate' within each .rate_hint button is used
//to determine whether the student is upvoting, downvoting, or flagging the hint. //to determine whether the student is upvoting, downvoting, or flagging the hint.
hint = $(this).parent().parent().find(".csh_hint").text(); hint = $(this).parent().parent().find(".csh_hint").text();
...@@ -247,7 +259,7 @@ function CrowdsourceHinter(runtime, element){ ...@@ -247,7 +259,7 @@ function CrowdsourceHinter(runtime, element){
} }
} }
}); });
}) })*/
$(element).on('click', '.csh_staff_rate', function(){ $(element).on('click', '.csh_staff_rate', function(){
//Staff ratings are the removal or unflagging of flagged hints from the database. The attribute 'data-rate' is used //Staff ratings are the removal or unflagging of flagged hints from the database. The attribute 'data-rate' is used
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment