Commit 76cff11f by Sola Committed by Piotr Mitros

changes to make colon/semicolon/quotes in hint submission not mess up the…

changes to make colon/semicolon/quotes in hint submission not mess up the feedback (replace : with a word, for example). replacement words are not elegant but they aren't anything someon would type in so they will be fine for now i think.
parent ea23c016
......@@ -115,6 +115,9 @@ class CrowdXBlock(XBlock):
def rate_hint(self, data, suffix=''):
data['ansnum'] = data['ansnum'].replace('ddeecciimmaallppooiinntt', '.')
data['ansnum'] = data['ansnum'].replace('qquueessttiioonnmmaarrkk', '?')
data['ansnum'] = data['ansnum'].replace('ccoolloonn', ':')
data['ansnum'] = data['ansnum'].replace('sseemmiiccoolloonn', ';')
data['ansnum'] = data['ansnum'].replace('qquuoottaattiioonnmmaarrkkss', '"')
for usdkey in self.Used:
if str(usdkey) == str(data['ansnum']):
print str(self.Used)
......
......@@ -97,7 +97,7 @@ class CrowdXBlock(XBlock):
keysh = self.hints[str(key)].keys()
random.shuffle(keysh)
print('keysh is ' + str(keysh))
for nextkey in self.hints[str(key)]:
for nextkey in keysh:
if howmanyhints < 3:
howmanyhints += 1 #limit number of hints shown
feedbackdict[str(nextkey)] = str(self.WrongAnswers[i])
......@@ -115,6 +115,8 @@ class CrowdXBlock(XBlock):
def rate_hint(self, data, suffix=''):
data['ansnum'] = data['ansnum'].replace('ddeecciimmaallppooiinntt', '.')
data['ansnum'] = data['ansnum'].replace('qquueessttiioonnmmaarrkk', '?')
data['ansnum'] = data['ansnum'].replace('ccoolloonn', ':')
data['ansnum'] = data['ansnum'].replace('sseemmiiccoolloonn', ';')
for usdkey in self.Used:
if str(usdkey) == str(data['ansnum']):
print str(self.Used)
......
......@@ -27,6 +27,12 @@ function CrowdXBlock(runtime, element){
$.each(result, function(index, value) {
valueid = value.replace(/\./g, 'ddeecciimmaallppooiinntt');
indexid = index.replace(/\./g, 'ddeecciimmaallppooiinntt');
valueid = valueid.replace(/\:/g, 'ccoolloonn');
indexid = indexid.replace(/\:/g, 'ccoolloonn');
valueid = valueid.replace(/\;/g, 'sseemmiiccoolloonn');
indexid = indexid.replace(/\;/g, 'sseemmiiccoolloonn');
valueid = valueid.replace(/\"/g, 'qquuoottaattiioonnmmaarrkkss');
indexid = indexid.replace(/\"/g, 'qquuoottaattiioonnmmaarrkkss');
if($("#submit"+valueid).length == 0){
$('.hintansarea').append("<p id=\"submit" + valueid + "\" class=\"hintsarea\"> </p>");
$('#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\">");
......
......@@ -27,6 +27,14 @@ function CrowdXBlock(runtime, element){
$.each(result, function(index, value) {
valueid = value.replace(/\./g, 'ddeecciimmaallppooiinntt');
indexid = index.replace(/\./g, 'ddeecciimmaallppooiinntt');
valueid = valueid.replace(/\:/g, 'ccoolloonn');
indexid = indexid.replace(/\:/g, 'ccoolloonn');
valueid = valueid.replace(/\;/g, 'sseemmiiccoolloonn');
indexid = indexid.replace(/\;/g, 'sseemmiiccoolloonn');
valueid = valueid.replace(/\?/g, 'qquueessttiioonnmmaarrkk');
indexid = indexid.replace(/\?/g, 'qquueessttiioonnmmaarrkk');
valueid = valueid.replace(/\"/g, 'qquuoottaattiioonnmmaarrkkss');
indexid = indexid.replace(/\"/g, 'qquuoottaattiioonnmmaarrkkss');
if($("#submit"+valueid).length == 0){
$('.hintansarea').append("<p id=\"submit" + valueid + "\" class=\"hintsarea\"> </p>");
$('#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\">");
......@@ -35,7 +43,7 @@ function CrowdXBlock(runtime, element){
$('#hintstoshow'+valueid).append("<p>" + index + "<input data-value=\"" + valueid + "\" id=\"" + indexid + "\" type=\"button\" class=\"hintbutton\" value=\"Upvote this Hint\"></p>");
}else{
$('#hintstoshow'+valueid).empty();
$('#hintstoshow'+valueid).append("<p id=\"hintstoshow" + valueid + "\"> No hints exist in the database. <p data-value=\"" + valueid + "\" id=\"" + indexid + "\"</p></p>");
$('#hintstoshow'+valueid).append("<p id=\"hintstoshow" + valueid + "\"> No hints exist in the database.</p> <p data-value=\"" + valueid + "\" id=\"" + indexid + "\"</p>");
}
});
}
......
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