Commit 1029ba95 by solashirai Committed by Piotr Mitros

continuing various works

parent 0c6d3d68
...@@ -129,12 +129,9 @@ class CrowdsourceHinter(XBlock): ...@@ -129,12 +129,9 @@ class CrowdsourceHinter(XBlock):
print(str(self.hint_database)) print(str(self.hint_database))
print(str(self.initial_hints)) print(str(self.initial_hints))
print(str(self.generic_hints)) print(str(self.generic_hints))
print(str(self.Flagged))
# populate hint_database with hints from initial_hints if there are no hints in hint_database. # populate hint_database with hints from initial_hints if there are no hints in hint_database.
# 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 = self.initial_hints
#temporarydict = ast.literal_eval(temporarydict)
#TODO: Figure out why temporarydict = self.initial_hints doesn't work. #TODO: Figure out why temporarydict = self.initial_hints doesn't work.
self.hint_database = copy.copy(self.initial_hints) self.hint_database = copy.copy(self.initial_hints)
...@@ -394,6 +391,8 @@ class CrowdsourceHinter(XBlock): ...@@ -394,6 +391,8 @@ 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>
...@@ -407,7 +406,20 @@ class CrowdsourceHinter(XBlock): ...@@ -407,7 +406,20 @@ 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)
print(node) #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(node.text)
print type(node) print type(node)
block.generic_hints = ["Make sure to check your answer for basic mistakes like spelling!"] block.generic_hints = ["Make sure to check your answer for basic mistakes like spelling!"]
......
/* CSS for CrowdsourceHinter */ /* CSS for CrowdsourceHinter */
.crowdsourcehinter_block .csh_feedback { .crowdsourcehinter_block .csh_feedback {
border-style: solid;
border-width: thin;
border-color: rgb(200,200,200);
} }
.crowdsourcehinter_block .csh_vote { .crowdsourcehinter_block .csh_vote {
...@@ -18,7 +15,6 @@ ...@@ -18,7 +15,6 @@
} }
.crowdsourcehinter_block { .crowdsourcehinter_block {
background-color: #BBE2ED;
} }
.csh_hint_reveal{ .csh_hint_reveal{
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div class="crowdsourcehinter_block"> <div class="crowdsourcehinter_block">
<div class='csh_hint_reveal'> <div class='csh_hint_reveal'>
<div class='csh_HintsToUse' student_answer = ''> <div class='csh_HintsToUse' student_answer = '' hint_received=''>
</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!">
......
...@@ -70,7 +70,8 @@ function CrowdsourceHinter(runtime, element){ ...@@ -70,7 +70,8 @@ function CrowdsourceHinter(runtime, element){
function seehint(result){ function seehint(result){
//Show a hint to the student after an incorrect answer is submitted. //Show a hint to the student after an incorrect answer is submitted.
$('.csh_HintsToUse', element).attr('student_answer', result.StudentAnswer); $('.csh_HintsToUse', element).attr('student_answer', result.StudentAnswer);
$('.csh_HintsToUse', element).text(result.HintsToUse); $('.csh_HintsToUse', element).attr('hint_received', result.HintsToUse);
$('.csh_HintsToUse', element).text("Hint: " + result.HintsToUse);
} }
function showHintFeedback(hint, student_answer){ function showHintFeedback(hint, student_answer){
...@@ -216,7 +217,7 @@ function CrowdsourceHinter(runtime, element){ ...@@ -216,7 +217,7 @@ function CrowdsourceHinter(runtime, element){
if ($(this).attr('data-rate') == "flag"){ if ($(this).attr('data-rate') == "flag"){
alert("This hint has been flagged for review."); alert("This hint has been flagged for review.");
} }
hint = $('.csh_HintsToUse', element).text(); hint = $('.csh_HintsToUse', element).attr('hint_received');
student_answer = $('.csh_HintsToUse', element).attr('student_answer'); student_answer = $('.csh_HintsToUse', element).attr('student_answer');
Logger.log('crowd_hinter.rate_hint.click.event', {"hint": hint, "student_answer": student_answer, "rating": $(this).attr('data-rate')}); Logger.log('crowd_hinter.rate_hint.click.event', {"hint": hint, "student_answer": student_answer, "rating": $(this).attr('data-rate')});
$.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