Commit ff636ee3 by Sola

minor changes

parent 26d6b8fb
...@@ -12,13 +12,13 @@ log = logging.getLogger(__name__) ...@@ -12,13 +12,13 @@ log = logging.getLogger(__name__)
#get_hint and get_feedback are in #get_hint and get_feedback are in
class CrowdXBlock(XBlock): class CrowdXBlock(XBlock):
correctanswer = String(default="42", scope=Scope.content) correctanswer = String(default="42", scope=Scope.content) #should be irrelevant for completed version
hints = Dict(default={"75": {"hint12":10, "hint22":0, "hints32":0}, "1": {"hint1":1, "hint2":1, "hint3":0}, "roflcopter": {"HighFyve":1000}}, scope=Scope.content) #All hints. sorted by type of mistake. type_of_incorrect_answer{"hint":rating, "hint":rating} hints = Dict(default={"75": {"hint12":10, "hint22":0, "hints32":0}, "1": {"hint1":1, "hint2":1, "hint3":0}, "roflcopter": {"HighFyve":1000}}, 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 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 WrongAnswers = List(default=[], scope=Scope.user_state) #List of mistakes made by user
DefaultHints = Dict(default={"hint": 100, "hinttwo": 10, "hintthree": 0, "hintasdf": 50, "aas;dklfj?": 1000, "SuperDuperBestHint": 10000}, scope=Scope.content) #Default hints in case no incorrect answers in hints match the user's mistake DefaultHints = Dict(default={"hint": 100, "hinttwo": 10, "hintthree": 0, "hintasdf": 50, "aas;dklfj?": 1000, "SuperDuperBestHint": 10000}, scope=Scope.content) #Default hints in case no incorrect answers in hints match the user's mistake
Used = List(default=[], scope=Scope.user_state)#List of used hints from HintsToUse Used = List(default=[], scope=Scope.user_state)#List of used hints from HintsToUse
Voted = Integer(default=0, scope=Scope.user_state) Voted = Integer(default=0, scope=Scope.user_state)#prevent multiple votes/hint submission
def student_view(self, context=None): def student_view(self, context=None):
html = self.resource_string("static/html/crowdxblock.html") html = self.resource_string("static/html/crowdxblock.html")
......
...@@ -12,7 +12,7 @@ log = logging.getLogger(__name__) ...@@ -12,7 +12,7 @@ log = logging.getLogger(__name__)
#get_hint and get_feedback are in #get_hint and get_feedback are in
class CrowdXBlock(XBlock): class CrowdXBlock(XBlock):
correctanswer = String(default="42", scope=Scope.content) correctanswer = String(default="42", scope=Scope.content) #should be irrelevant for completed version
hints = Dict(default={"75": {"hint12":10, "hint22":0, "hints32":0}, "1": {"hint1":1, "hint2":1, "hint3":0}, "roflcopter": {"HighFyve":1000}}, scope=Scope.content) #All hints. sorted by type of mistake. type_of_incorrect_answer{"hint":rating, "hint":rating} hints = Dict(default={"75": {"hint12":10, "hint22":0, "hints32":0}, "1": {"hint1":1, "hint2":1, "hint3":0}, "roflcopter": {"HighFyve":1000}}, 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 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 WrongAnswers = List(default=[], scope=Scope.user_state) #List of mistakes made by user
...@@ -112,7 +112,7 @@ class CrowdXBlock(XBlock): ...@@ -112,7 +112,7 @@ class CrowdXBlock(XBlock):
print("hints are " + str(self.hints[str(key)])) print("hints are " + str(self.hints[str(key)]))
print("otherstuff " + str(self.hints)) print("otherstuff " + str(self.hints))
else: else:
ansnum = self.Used.index[data['submission']] ansnum = self.Used.index(data['submission'])
for key in self.DefaultHints: for key in self.DefaultHints:
if key == self.Used[int(ansnum)]: #rating for hints in DefaultHints if key == self.Used[int(ansnum)]: #rating for hints in DefaultHints
self.DefaultHints[str(key)] += int(1) self.DefaultHints[str(key)] += int(1)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<span><br><span> Dummy Answer Input Here</span></span> <span><br><span> Dummy Answer Input Here</span></span>
<section id="studentinput" class="textinput"> <section id="studentinput" class="textinput">
<input type="text" name="studentanswer" id="studentsubmit" class="math" size="40"> <input type="text" name="studentanswer" id="studentsubmit" class="math" size="40">
<input id="studentanswer" type="button" value="Submit Answer"> <input id="studentanswer" type="button" class="button" value="Submit Answer">
</div> </div>
<div class="crowdxblock_block"> <div class="crowdxblock_block">
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<span class='HintUsed3'></span> <span class='HintUsed3'></span>
</p> </div> </p> </div>
<p> <p>
<input id="caus" type="button" value="clearAllUserState"> <input id="caus" type="button" class="button" value="clearAllUserState">
</p> </p>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<span><br><span> Enter and submit your own hint!</span></span> <span><br><span> Enter and submit your own hint!</span></span>
<section id="studentinput" class="textinput"> <section id="studentinput" class="textinput">
<input type="text" name="studentinput" id="answer" class="math" size="40"> <input type="text" name="studentinput" id="answer" class="math" size="40">
<input id="submit" type="button" value="Submit Hint"> <input id="submit" type="button" class="button" value="Submit Hint">
</div></section></span> </div></section></span>
</section> </section>
......
<div class="crowdxblock_block" style="background-color:#00FFFF;"> <!--most stuff just for testing purposes--> <div class="crowdxblock_block"> <!--most stuff just for testing purposes-->
<p>It's Hintin' Time! Here's your hint! <span class='HintsToUse'>{self.HintsToUse}</span> <p>It's Hintin' Time! Here's your hint! <span class='HintsToUse'>{self.HintsToUse}</span>
</p> </p>
<span><br><span> Dummy Answer Input Here</span></span> <span><br><span> Dummy Answer Input Here</span></span>
......
...@@ -81,7 +81,8 @@ function CrowdXBlock(runtime, element){ ...@@ -81,7 +81,8 @@ function CrowdXBlock(runtime, element){
url: runtime.handlerUrl(element, 'give_hint'), url: runtime.handlerUrl(element, 'give_hint'),
data: JSON.stringify({"submission": $('#answer').val()}), //give hin for first incorrect answer data: JSON.stringify({"submission": $('#answer').val()}), //give hin for first incorrect answer
success: finish success: finish
});}) });
$("#answer").val('');})
$('#caus', element).click(function(eventObject) { $('#caus', element).click(function(eventObject) {
console.debug("ca working"); console.debug("ca working");
...@@ -90,7 +91,9 @@ function CrowdXBlock(runtime, element){ ...@@ -90,7 +91,9 @@ function CrowdXBlock(runtime, element){
url: runtime.handlerUrl(element, 'clear_states'), url: runtime.handlerUrl(element, 'clear_states'),
data: JSON.stringify({"hello": "world"}), //give hin for first incorrect answer data: JSON.stringify({"hello": "world"}), //give hin for first incorrect answer
success: clearstates success: clearstates
});}) });
$("#studentsubmit").val('');
$("#answer").val('');})
function finish(){ function finish(){
$("#pair0").hide(); $("#pair0").hide();
$("#pair3").hide(); $("#pair3").hide();
...@@ -139,6 +142,7 @@ function CrowdXBlock(runtime, element){ ...@@ -139,6 +142,7 @@ function CrowdXBlock(runtime, element){
data: JSON.stringify({"submittedanswer": $('#studentsubmit').val()}), //return student's incorrect answer here data: JSON.stringify({"submittedanswer": $('#studentsubmit').val()}), //return student's incorrect answer here
success: checkreply success: checkreply
}); });
$("#studentsubmit").val('');
/* } else { //answer is correct /* } else { //answer is correct
$('.correct', element).text("You're correct! Please choose the best hint, or provide us with one of your own!"); $('.correct', element).text("You're correct! Please choose the best hint, or provide us with one of your own!");
$.ajax({ $.ajax({
......
...@@ -81,7 +81,9 @@ function CrowdXBlock(runtime, element){ ...@@ -81,7 +81,9 @@ function CrowdXBlock(runtime, element){
url: runtime.handlerUrl(element, 'give_hint'), url: runtime.handlerUrl(element, 'give_hint'),
data: JSON.stringify({"submission": $('#answer').val()}), //give hin for first incorrect answer data: JSON.stringify({"submission": $('#answer').val()}), //give hin for first incorrect answer
success: finish success: finish
});}) });
$("#answer").val('');})
$('#caus', element).click(function(eventObject) { $('#caus', element).click(function(eventObject) {
console.debug("ca working"); console.debug("ca working");
$.ajax({ $.ajax({
...@@ -89,7 +91,9 @@ function CrowdXBlock(runtime, element){ ...@@ -89,7 +91,9 @@ function CrowdXBlock(runtime, element){
url: runtime.handlerUrl(element, 'clear_states'), url: runtime.handlerUrl(element, 'clear_states'),
data: JSON.stringify({"hello": "world"}), //give hin for first incorrect answer data: JSON.stringify({"hello": "world"}), //give hin for first incorrect answer
success: clearstates success: clearstates
});}) });
$("#studentsubmit").val('');
$("#answer").val('');})
function finish(){ function finish(){
$("#pair0").hide(); $("#pair0").hide();
$("#pair3").hide(); $("#pair3").hide();
...@@ -138,6 +142,7 @@ function CrowdXBlock(runtime, element){ ...@@ -138,6 +142,7 @@ function CrowdXBlock(runtime, element){
data: JSON.stringify({"submittedanswer": $('#studentsubmit').val()}), //return student's incorrect answer here data: JSON.stringify({"submittedanswer": $('#studentsubmit').val()}), //return student's incorrect answer here
success: checkreply success: checkreply
}); });
$("#studentsubmit").val('');
/* } else { //answer is correct /* } else { //answer is correct
$('.correct', element).text("You're correct! Please choose the best hint, or provide us with one of your own!"); $('.correct', element).text("You're correct! Please choose the best hint, or provide us with one of your own!");
$.ajax({ $.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