Commit e597f911 by solashirai

fixes/improvement to UX

parent 80afc470
......@@ -132,8 +132,6 @@ class CrowdsourceHinter(XBlock):
remaining_hints = str(self.find_hints(answer))
if remaining_hints != str(0):
for hint in self.hint_database[str(answer)]:
print hint, self.reported_hints.keys()
print str(self.reported_hints)
if hint not in self.reported_hints.keys():
#if best_hint hasn't been set yet or the rating of hints is greater than the rating of best_hint
if (best_hint == "" or self.hint_database[str(answer)][hint] > self.hint_database[str(answer)][str(best_hint)]):
......@@ -231,7 +229,6 @@ class CrowdsourceHinter(XBlock):
answer_data = data['student_answer']
data_rating = data['student_rating']
data_hint = data['hint']
print data_rating, answer_data
if data['student_rating'] == 'unreport':
for reported_hints in self.reported_hints:
if reported_hints == data_hint:
......@@ -265,6 +262,8 @@ class CrowdsourceHinter(XBlock):
The rating associated with the hint is returned. This rating is identical
to what would be found under self.hint_database[answer_string[hint_string]]
"""
if any(data_hint in generic_hints for generic_hints in self.generic_hints):
return
if data_rating == 'upvote':
self.hint_database[str(answer_data)][str(data_hint)] += 1
else:
......
......@@ -39,7 +39,7 @@
align-self: flex-end;
}
.csh_rate_hint, .csh_report_hint, .csh_rate_hint_completed {
.csh_rate_hint, .csh_report_hint, .csh_rate_hint_completed, .csh_rate_hint_text {
margin-right: 15px;
margin-top: 5px;
align-self: flex-end;
......@@ -59,6 +59,15 @@ background-clip: padding-box;
font-size: 0.8125em;
}
.csh_hint_text[rating="upvote"] {
color: green;
}
.csh_hint_text[rating="downvote"] {
color: red;
}
.csh_rate_hint[data-rate="upvote"] {
color: green;
font-weight: bold;
......
<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>
<div class="csh_hint">Your original hint was: <b>{{hintText}}</b></div>
</div>
<div class='csh_rating_data'>
<div role="button" class="csh_rate_hint" data-rate="upvote">
......@@ -62,14 +62,17 @@
<div class="crowdsourcehinter_block">
<div class='csh_hint_reveal'>
<div class='csh_hint_text' student_answer = '' hint_received=''>
<div class='csh_hint_text' student_answer = '' hint_received='' rating=''>
</div>
<div class='csh_hint_rating_on_incorrect'>
<div class="csh_rate_hint_text">
Rate this hint:
</div>
<div role="button" class="csh_rate_hint" data-rate="upvote" title="This hint was helpful!">
<b>+</b>
<b>Helpful</b>
</div>
<div role="button" class="csh_rate_hint" data-rate="downvote" title="This hint was not very helpful.">
<b>-</b>
<b>Unhelpful</b>
</div>
<div role="button" class="csh_report_hint" title="Report this hint">
<b></b>
......
......@@ -95,6 +95,8 @@ function CrowdsourceHinter(runtime, element, data){
$('.csh_hint_text', element).attr('student_answer', result.StudentAnswer);
$('.csh_hint_text', element).attr('hint_received', result.BestHint);
$('.csh_hint_text', element).text("Hint: " + result.BestHint);
$('.csh_rate_hint_completed', element).attr('class', 'csh_rate_hint');
$('.csh_hint_text', element).attr('rating', '');
Logger.log('crowd_hinter.showHint', {"student_answer": result.StudentAnswer, "hint_received": result.Hints});
}
......@@ -224,6 +226,7 @@ function CrowdsourceHinter(runtime, element, data){
*/
function rate_hint(){ return function(rateHintButtonHTML){
rating = rateHintButtonHTML.currentTarget.attributes['data-rate'].value;
$('.csh_hint_text', element).attr('rating', rating);
hint = $('.csh_hint_text', element).attr('hint_received');
student_answer = $('.csh_hint_text', element).attr('student_answer');
$.ajax({
......
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