Commit 4dd4f353 by solashirai

some css and html changes

parent 1635bd64
...@@ -6,7 +6,6 @@ import random ...@@ -6,7 +6,6 @@ import random
import json import json
import copy import copy
from copy import deepcopy from copy import deepcopy
from eventtracking import tracker
from xblock.core import XBlock from xblock.core import XBlock
from xblock.fields import Scope, Dict, List, Boolean from xblock.fields import Scope, Dict, List, Boolean
...@@ -155,13 +154,11 @@ class CrowdsourceHinter(XBlock): ...@@ -155,13 +154,11 @@ class CrowdsourceHinter(XBlock):
# for multiple submissions/hint requests # for multiple submissions/hint requests
if best_hint not in self.Flagged.keys(): if best_hint not in self.Flagged.keys():
self.Used.append(best_hint) self.Used.append(best_hint)
tracker.emit('get_hint', answer, best_hint, 'best hint')
return {'HintsToUse': best_hint, "StudentAnswer": answer} return {'HintsToUse': best_hint, "StudentAnswer": answer}
if best_hint not in self.Used: if best_hint not in self.Used:
# choose highest rated hint for the incorrect answer # choose highest rated hint for the incorrect answer
if best_hint not in self.Flagged.keys(): if best_hint not in self.Flagged.keys():
self.Used.append(best_hint) self.Used.append(best_hint)
tracker.emit('get_hint', answer, best_hint, 'best hint')
return {'HintsToUse': best_hint, "StudentAnswer": answer} return {'HintsToUse': best_hint, "StudentAnswer": answer}
# choose another random hint for the answer. # choose another random hint for the answer.
temporary_hints_list = [] temporary_hints_list = []
...@@ -171,13 +168,11 @@ class CrowdsourceHinter(XBlock): ...@@ -171,13 +168,11 @@ class CrowdsourceHinter(XBlock):
temporary_hints_list.append(str(hint_keys)) temporary_hints_list.append(str(hint_keys))
not_used = random.choice(temporary_hints_list) not_used = random.choice(temporary_hints_list)
self.Used.append(not_used) self.Used.append(not_used)
tracker.emit('get_hint', answer, not_used, 'unused hint')
return {'HintsToUse': not_used, "StudentAnswer": answer} return {'HintsToUse': not_used, "StudentAnswer": answer}
else: else:
if len(self.generic_hints) != 0: if len(self.generic_hints) != 0:
not_used = random.choice(self.generic_hints) not_used = random.choice(self.generic_hints)
self.Used.append(not_used) self.Used.append(not_used)
tracker.emit('get_hint', answer, not_used, 'generic hint')
return {'HintsToUse': not_used, "StudentAnswer": answer} return {'HintsToUse': not_used, "StudentAnswer": answer}
else: else:
# if there are no more hints left in either the database or defaults # if there are no more hints left in either the database or defaults
...@@ -310,24 +305,20 @@ class CrowdsourceHinter(XBlock): ...@@ -310,24 +305,20 @@ class CrowdsourceHinter(XBlock):
for flagged_hints in self.Flagged: for flagged_hints in self.Flagged:
if flagged_hints == data_hint: if flagged_hints == data_hint:
self.Flagged.pop(data_hint, None) self.Flagged.pop(data_hint, None)
tracker.emit('rate_hint', data, 'unflagged')
return {'rating': 'unflagged'} return {'rating': 'unflagged'}
if data['student_rating'] == 'remove': if data['student_rating'] == 'remove':
for flagged_hints in self.Flagged: for flagged_hints in self.Flagged:
if data_hint == flagged_hints: if data_hint == flagged_hints:
self.hint_database[self.Flagged[data_hint]].pop(data_hint, None) self.hint_database[self.Flagged[data_hint]].pop(data_hint, None)
self.Flagged.pop(data_hint, None) self.Flagged.pop(data_hint, None)
tracker.emit('rate_hint', data, 'removed')
return {'rating': 'removed'} return {'rating': 'removed'}
if data['student_rating'] == 'flag': if data['student_rating'] == 'flag':
# add hint to Flagged dictionary # add hint to Flagged dictionary
self.Flagged[str(data_hint)] = answer_data self.Flagged[str(data_hint)] = answer_data
tracker.emit('rate_hint', data, 'flagged')
return {"rating": 'flagged', 'hint': data_hint} return {"rating": 'flagged', 'hint': data_hint}
if str(data_hint) not in self.Voted: if str(data_hint) not in self.Voted:
self.Voted.append(str(data_hint)) # add data to Voted to prevent multiple votes self.Voted.append(str(data_hint)) # add data to Voted to prevent multiple votes
rating = self.change_rating(data_hint, data_rating, answer_data) # change hint rating rating = self.change_rating(data_hint, data_rating, answer_data) # change hint rating
tracker.emit('rate_hint', data, 'rating changed')
if str(rating) == str(0): if str(rating) == str(0):
return {"rating": str(0), 'hint': data_hint} return {"rating": str(0), 'hint': data_hint}
else: else:
...@@ -367,7 +358,6 @@ class CrowdsourceHinter(XBlock): ...@@ -367,7 +358,6 @@ class CrowdsourceHinter(XBlock):
""" """
submission = data['submission'] submission = data['submission']
answer = data['answer'] answer = data['answer']
tracker.emit('give_hint', answer, submission)
if str(submission) not in self.hint_database[str(answer)]: if str(submission) not in self.hint_database[str(answer)]:
self.hint_database[str(answer)].update({submission: 0}) self.hint_database[str(answer)].update({submission: 0})
return return
...@@ -395,8 +385,6 @@ class CrowdsourceHinter(XBlock): ...@@ -395,8 +385,6 @@ class CrowdsourceHinter(XBlock):
""" """
<verticaldemo> <verticaldemo>
<crowdsourcehinter> <crowdsourcehinter>
"Hello world!"
Hello World!
{"initial_hint_answer": "michigann", "initial_hint_text": "you have an extra n", "generic_hint": "make sure to chekc your spelling"} {"initial_hint_answer": "michigann", "initial_hint_text": "you have an extra n", "generic_hint": "make sure to chekc your spelling"}
</crowdsourcehinter> </crowdsourcehinter>
</verticaldemo> </verticaldemo>
...@@ -410,22 +398,5 @@ class CrowdsourceHinter(XBlock): ...@@ -410,22 +398,5 @@ class CrowdsourceHinter(XBlock):
A minimal working test for parse_xml A minimal working test for parse_xml
""" """
block = runtime.construct_xblock_from_class(cls, keys) block = runtime.construct_xblock_from_class(cls, keys)
import pdb; pdb.set_trace() #import pdb; pdb.set_trace()
#['__class__', '__contains__', '__copy__', '__deepcopy__', '__delattr__', '__delitem__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__hash__', '__init__', '__iter__', '__len__', '__module__', '__new__', '__nonzero__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__setattr__', '__setitem__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '_filter', '_init', 'addnext', 'addprevious', 'append', 'attrib', 'base', 'blacklist', 'clear', 'extend', 'find', 'findall', 'findtext', 'get', 'getchildren', 'getiterator', 'getnext', 'getparent', 'getprevious', 'getroottree', 'index', 'insert', 'items', 'iter', 'iterancestors', 'iterchildren', 'iterdescendants', 'iterfind', 'itersiblings', 'itertext', 'keys', 'makeelement', 'nsmap', 'prefix', 'remove', 'replace', 'set', 'sourceline', 'tag', 'tail', 'text', 'values', 'xpath']
print(node.tag)
print(node.tail)
print(node.values)
print(node.xpath)
print(node.items)
print(node.iterchildren)
print(node.itertext)
print(node.keys)
print(node.makeelement)
print(node.sourceline)
print(node.tag)
print(node.text)
print type(node)
block.generic_hints = ["Make sure to check your answer for basic mistakes like spelling!"]
block.initial_hints = {"michigann": {"You have an extra N in your answer": 1}}
return block return block
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
<div class="csh_hint"><b>{{hint}}</b></div> <div class="csh_hint"><b>{{hint}}</b></div>
</div> </div>
<div class='csh_rating_data'> <div class='csh_rating_data'>
<div role="button" class="csh_rate_hint" data-rate="upvote" data-icon="arrow-u" aria-label="upvote"> <div role="button" class="csh_rate_hint" data-rate="upvote" data-icon="arrow-u" title="This hint was helpful">
<b>This hint was helpful</b> <b>+</b>
</div> </div>
<div role="button" class="csh_rate_hint" data-rate="downvote" aria-label="downvote"> <div role="button" class="csh_rate_hint" data-rate="downvote" title="This hint was not helpful.">
<b>This hint was not helpful</b> <b>-</b>
</div> </div>
<div role="button" class="csh_rate_hint" data-rate="flag" data-icon="flag" aria-label="flag"> <div role="button" class="csh_rate_hint" data-rate="flag" data-icon="flag" title="Report this hint.">
<b>Report this hint</b> <b></b>
</div> </div>
</div> </div>
</div> </div>
...@@ -20,18 +20,18 @@ ...@@ -20,18 +20,18 @@
<script type="x-tmpl/mustache" id="show_flagged_feedback"> <script type="x-tmpl/mustache" id="show_flagged_feedback">
<div class="csh_hint_value" value ="{{hint}}"> <div class="csh_hint_value" value ="{{hint}}">
<div role="button" class="csh_staff_rate" data-rate="unflag" aria-label="unflag"> <div role="button" class="csh_staff_rate" data-rate="unflag" aria-label="unflag">
<b>O</b> <b>Unflag Hint</b>
</div> </div>
<div class="csh_hint">{{hint}}</div> <div class="csh_hint">{{hint}}</div>
<div role="button" class="csh_staff_rate" data-rate="remove" aria-label="remove"> <div role="button" class="csh_staff_rate" data-rate="remove" aria-label="remove">
<b>X</b> <b>Remove Hint</b>
</div> </div>
</div> </div>
</script> </script>
<script type="x-tmpl/mustache" id="student_hint_creation"> <script type="x-tmpl/mustache" id="student_hint_creation">
<p> <p>
<textarea type="text" name="studentinput" class="csh_student_text_input"></textarea> <input type="text" name="studentinput" class="csh_student_text_input">
</p> </p>
<p> <p>
<input answer="{{student_answer}}" type="button" class="csh_submit_new" value="Submit Hint"> <input answer="{{student_answer}}" type="button" class="csh_submit_new" value="Submit Hint">
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,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" answer={{answer}}> <h class="csh_answer_text" answer={{answer}}>
<i> Your original answer: {{answer}} <br> The hint you viewed: </i></h> <i> Your original answer: </i>{{answer}} <br> <i>The hint you viewed: </i></h>
</div> </div>
</script> </script>
...@@ -64,10 +64,10 @@ ...@@ -64,10 +64,10 @@
</div> </div>
<div class='csh_HintQuickFeedback'> <div class='csh_HintQuickFeedback'>
<div role="button" class="csh_rate_hint" data-rate="upvote" title="This hint was helpful!"> <div role="button" class="csh_rate_hint" data-rate="upvote" title="This hint was helpful!">
<b></b> <b>+</b>
</div> </div>
<div role="button" class="csh_rate_hint" data-rate="downvote" title="This hint was not very helpful."> <div role="button" class="csh_rate_hint" data-rate="downvote" title="This hint was not very helpful.">
<b></b> <b>-</b>
</div> </div>
<div role="button" class="csh_rate_hint" data-rate="flag" title="Report this hint"> <div role="button" class="csh_rate_hint" data-rate="flag" title="Report this hint">
<b></b> <b></b>
......
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