correctanswer=String(default="2.0",scope=Scope.content)#should be irrelevant for completed version
hints=Dict(default={"2":{"Keep significant figures in mind.":1,"So close yet so far.":0,"Try adding a .0.":0},"8.6":{"You might have added all of the horizontal forces together to equal a total of 21 for the horizontal component of this object's force; the two forces are facing opposite direction, so you need to subtract them.":1,"Try 12-9 for the total horizontal force.":0},"1.2":{"Did you remember to add in the vertical component of force for this object?":0},"1.0":{"dummy hint for debugs":0},"one":{"dummy hint again for debugs":0}},scope=Scope.content)
hints=Dict(default={"2":{"Keep significant figures in mind.":1,"So close yet so far.":0,"Try adding a .0.":0},"8.6":{"You might have added all of the horizontal forces together to equal a total of 21 for the horizontal component of this object's force. The two forces are facing opposite direction, so you need to subtract them.":1,"Try 12-9 for the total horizontal force.":0},"1.2":{"Did you remember to add in the vertical component of force for this object?":0}},scope=Scope.content)
#All hints. sorted by type of mistake. type_of_incorrect_answer{"hint":rating, "hint":rating}
HintsToUse=Dict(default={},scope=Scope.user_state)#Dict of hints to provide user
WrongAnswers=List(default=[],scope=Scope.user_state)#List of mistakes made by user
...
...
@@ -54,14 +54,13 @@ class CrowdXBlock(XBlock):
self.hints[str(data["submittedanswer"])]={}#add user's incorrect answer to WrongAnswers
correctanswer = String(default="2.0", scope=Scope.content) #should be irrelevant for completed version
hints = Dict(default={"2": {"Keep significant figures in mind.":1, "So close yet so far.":0, "Try adding a .0.":0}, "8.6": {"You might have added all of the horizontal forces together to equal a total of 21 for the horizontal component of this object's force; the two forces are facing opposite direction, so you need to subtract them.":1, "Try 12-9 for the total horizontal force.":0}, "1.2": {"Did you remember to add in the vertical component of force for this object?":0},"1.0":{"dummy hint for debugs":0}, "one":{"dummy hint again for debugs":0}}, scope=Scope.content)
hints = Dict(default={"2": {"Keep significant figures in mind.":1, "So close yet so far.":0, "Try adding a .0.":0}, "8.6": {"You might have added all of the horizontal forces together to equal a total of 21 for the horizontal component of this object's force. The two forces are facing opposite direction, so you need to subtract them.":1, "Try 12-9 for the total horizontal force.":0}, "1.2": {"Did you remember to add in the vertical component of force for this object?":0}}, scope=Scope.content)
#All hints. sorted by type of mistake. type_of_incorrect_answer{"hint":rating, "hint":rating}
HintsToUse = Dict(default={}, scope=Scope.user_state) #Dict of hints to provide user
WrongAnswers = List(default=[], scope=Scope.user_state) #List of mistakes made by user
...
...
@@ -54,14 +54,13 @@ class CrowdXBlock(XBlock):
self.hints[str(data["submittedanswer"])] = {} #add user's incorrect answer to WrongAnswers
self.HintsToUse = {}
self.HintsToUse.update(self.DefaultHints)
print str(self.hints)
if max(self.HintsToUse.iteritems(), key=operator.itemgetter(1))[0] not in self.Used:
self.Used.append(max(self.HintsToUse.iteritems(), key=operator.itemgetter(1))[0]) #Highest rated hint is shown first
$('#submit'+value).append("For your incorrect answer of:"+" "+value+" <p id=\"hintstoshow"+value+"\"> The following hints exist: </p><p> <input id=\""+index+"\" type=\"button\" class=\"submitbutton\" value=\"Submit a hint for this problem\">");
$('#submit'+valueid).append("For your incorrect answer of:"+" "+value+" <p id=\"hintstoshow"+valueid+"\"> The following hints exist: </p><p> <input id=\""+indexid+"\" type=\"button\" class=\"submitbutton\" value=\"Submit a hint for this problem\">");
}
$('#hintstoshow'+value).append("<p>"+index+"<input data-value=\""+value+"\" id=\""+index+"\" type=\"button\" class=\"hintbutton\" value=\"Upvote this Hint\"></p>");
console.log('indexid'+indexid);
$('#hintstoshow'+valueid).append("<p>"+index+"<input data-value=\""+valueid+"\" id=\""+indexid+"\" type=\"button\" class=\"hintbutton\" value=\"Upvote this Hint\"></p>");
$('#submit'+value).append("For your incorrect answer of:" + " " + value + " <p id=\"hintstoshow" + value + "\"> The following hints exist: </p><p> <input id=\"" + index + "\" type=\"button\" class=\"submitbutton\" value=\"Submit a hint for this problem\">");
$('#submit'+valueid).append("For your incorrect answer of:" + " " + value + " <p id=\"hintstoshow" + valueid + "\"> The following hints exist: </p><p> <input id=\"" + indexid + "\" type=\"button\" class=\"submitbutton\" value=\"Submit a hint for this problem\">");
}
$('#hintstoshow'+value).append("<p>" + index + "<input data-value=\"" + value + "\" id=\"" + index + "\" type=\"button\" class=\"hintbutton\" value=\"Upvote this Hint\"></p>");
console.log('indexid' + indexid);
$('#hintstoshow'+valueid).append("<p>" + index + "<input data-value=\"" + valueid + "\" id=\"" + indexid + "\" type=\"button\" class=\"hintbutton\" value=\"Upvote this Hint\"></p>");