Commit f141cafd by solashirai Committed by Piotr Mitros

fixed incorporation of initial hints

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