Commit b88e5287 by solashirai Committed by Piotr Mitros

test push

parent a151e638
......@@ -144,9 +144,10 @@ class CrowdsourceHinter(XBlock):
data['submittedanswer']: The string of text that the student submits for a problem.
returns:
'bestHint': the highest rated hint for an incorrect answer
'BestHint': the highest rated hint for an incorrect answer
or another random hint for an incorrect answer
or 'Sorry, there are no more hints for this answer.' if no more hints exist
'StudentAnswer': the student's incorrect answer
"""
# populate hint_database with hints from initial_hints if there are no hints in hint_database.
# this probably will occur only on the very first run of a unit containing this block.
......@@ -185,7 +186,7 @@ class CrowdsourceHinter(XBlock):
else:
# if there are no hints in either the database or generic hints
self.used.append(str("There are no hints for" + " " + answer))
return {'Hints': "Sorry, there are no hints for this answer.", "StudentAnswer": answer}
return {'BestHint': "Sorry, there are no hints for this answer.", "StudentAnswer": answer}
def find_hints(self, answer):
"""
......@@ -264,6 +265,10 @@ class CrowdsourceHinter(XBlock):
data['student_answer']: The incorrect answer that corresponds to the hint that is being rated
data['hint']: The hint that is being rated
data['student_rating']: The rating chosen by the student.
Returns:
'rating': the new rating of the hint, or the string 'reported' if the hint was reported
'hint': the hint that had its rating changed
"""
answer_data = data['student_answer']
data_rating = data['student_rating']
......@@ -305,8 +310,10 @@ class CrowdsourceHinter(XBlock):
return
if data_rating == 'upvote':
self.hint_database[str(answer_data)][str(data_hint)] += 1
return self.hint_database[str(answer_data)][str(data_hint)]
else:
self.hint_database[str(answer_data)][str(data_hint)] -= 1
return self.hint_database[str(answer_data)][str(data_hint)]
@XBlock.json_handler
def add_new_hint(self, data, suffix=''):
......
......@@ -27,6 +27,7 @@
display: flex;
flex-direction: row;
justify-content: space-between;
flex-shrink: 0;
}
.csh_hint_data{
......@@ -38,6 +39,7 @@
display: flex;
flex-direction: row;
align-self: flex-end;
flex-shrink: 0;
}
.csh_rate_hint, .csh_report_hint, .csh_rate_hint_completed, .csh_rate_hint_text {
......@@ -55,27 +57,36 @@ div[data-rate="report"]{
font-weight: 600;
align-self: flex-end;
box-shadow: 0px 0px 8px 4px #C7BEBE inset, 0px 0px 8px 4px #C7BEBE inset;
background-clip: padding-box;
font-size: 0.8125em;
background-clip: padding-box;
font-size: 0.8125em;
}
.csh_hint_text[rating="upvote"] {
.csh_rate_hint[data-rate="upvote"] {
color: green;
font-weight: bold;
transition: background .4s ease-in
}
.csh_rate_hint[data-rate="upvote"]:hover {
background-color: #BCBCBC;
}
.csh_hint_text[rating="downvote"] {
.csh_rate_hint[data-rate="downvote"] {
color: red;
font-weight: bold;
transition: background .4s ease-in
}
.csh_rate_hint[data-rate="downvote"]:hover {
background-color: #BCBCBC;
}
.csh_rate_hint[data-rate="upvote"] {
color: green;
font-weight: bold;
.csh_report_hint {
transition: background .4s ease-in
}
.csh_rate_hint[data-rate="downvote"] {
color: red;
font-weight: bold;
.csh_report_hint:hover {
background-color: #BCBCBC;
}
.csh_reported_hints {
......
......@@ -187,7 +187,6 @@ function CrowdsourceHinter(runtime, element, data){
$('.csh_submit_new', element).remove();
$(createTextInputButtonHTML.currentTarget).hide();
student_answer = $('.csh_answer_text', element).attr('answer');
console.log(student_answer);
var hintTextInputTemplate = $(Mustache.render($('#hint_text_input').html(), {student_answer: student_answer}));
$('.csh_answer_text', element).append(hintTextInputTemplate);
}}
......
......@@ -28,7 +28,7 @@ function CrowdsourceHinterStudio(runtime, element, data){
} else {
$('.csh_check_success', element).text('there was a problem adding your hints to the database. check the format on your hints.');
}
Logger.log('crowd_hinter.staff_edit_hinter', {"generic_hints": initial, "initial_hint": generic, "element": hinting_element, "successfully_set_hints": result.success});
Logger.log('crowd_hinter.staff_edit_hinter', {"generic_hints": generic, "initial_hint": initial, "element": hinting_element, "successfully_set_hints": result.success});
}
});
}}
......
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