Commit f141cafd by solashirai Committed by Piotr Mitros

fixed incorporation of initial hints

parent 2a5978fa
......@@ -120,7 +120,8 @@ class CrowdsourceHinter(XBlock):
# this probably will occur only on the very first run of a unit containing this block.
if not bool(self.hint_database):
temporarydict = {}
temporarydict = self.initial_hints
temporarydict = str(self.initial_hints)
temporarydict = ast.literal_eval(temporarydict)
self.hint_database = temporarydict
answer = str(data["submittedanswer"])
answer = answer.lower() # for analyzing the student input string I make it lower case.
......
......@@ -45,7 +45,6 @@
.csh_rate_hint {
margin-right: 15px;
margin-top: 5px;
font-size: 70%;
align-self: flex-end;
}
......@@ -86,7 +85,7 @@ div[data-rate="downvote"] {
}
.csh_rating{
margin-right: 10px;
margin-right: 5px;
}
.csh_rate_hint{ cursor: pointer }
......
......@@ -42,7 +42,7 @@
<script type="x-tmpl/mustache" id="show_answer_feedback">
<div class="csh_student_answer">
<h class="csh_answer_text"><i>Your incorrect answer: {{answer}}</i></h>
<h class="csh_answer_text" answer={{answer}}><i> Your answer: {{answer}}</i></h>
</div>
</script>
......
......@@ -77,7 +77,7 @@ function CrowdsourceHinter(runtime, element){
//Append answer-specific hints for each student answer during the feedback stage.
//This appended div includes upvote/downvote/flagging buttons, the hint, and the hint's rating
$(".csh_student_answer", element).each(function(){
if ($(this).find('.csh_answer_text').text() == student_answer){
if ($(this).find('.csh_answer_text').attr('answer') == student_answer){
var html = "";
$(function(){
var data = {
......@@ -134,7 +134,7 @@ function CrowdsourceHinter(runtime, element){
//hints return null if no answer-specific hints exist
if(hint === "null"){
$(".csh_student_answer", element).each(function(){
if ($(this).find('.csh_answer_text').text() == student_answer){
if ($(this).find('.csh_answer_text').attr('answer') == student_answer){
var html = "";
var template = $('#show_no_hints').html();
var data = {};
......@@ -165,9 +165,9 @@ function CrowdsourceHinter(runtime, element){
$('.csh_student_text_input').remove();
$('.csh_submit_new').remove();
$(this).hide();
student_answer = $(this).parent().parent().find('.csh_answer_text').text();
student_answer = $(this).parent().parent().find('.csh_answer_text').attr('answer');
$(".csh_student_answer", element).each(function(){
if ($(this).find('.csh_answer_text').text() == student_answer){
if ($(this).find('.csh_answer_text').attr('answer') == student_answer){
var html = "";
$(function(){
var template = $('#student_hint_creation').html();
......@@ -220,7 +220,7 @@ function CrowdsourceHinter(runtime, element){
//Staff ratings are the removal or unflagging of flagged hints from the database. The attribute 'data-rate' is used
//to determine whether to unflag or delete the hint.
hint = $(this).parent().find(".csh_hint").text();
student_answer = $(this).parent().parent().find('.csh_answer_text').text();
student_answer = $(this).parent().parent().find('.csh_answer_text').attr('answer');
$.ajax({
type: "POST",
url: runtime.handlerUrl(element, 'rate_hint'),
......
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