Commit 5f6ec7f6 by solashirai Committed by Piotr Mitros

commit for meeting

parent f9dfc035
# pylint: disable=line-too-long
# pylint: disable=unused-argument
import ast
import logging
import operator
import pkg_resources
import random
import json
import hashlib
from xblock.core import XBlock
from xblock.fields import Scope, Dict, List, Boolean
......@@ -116,6 +115,9 @@ class CrowdsourceHinter(XBlock):
or another random hint for an incorrect answer
or 'Sorry, there are no more hints for this answer.' if no more hints exist
"""
print(str(self.hint_database))
print(str(self.initial_hints))
print(str(self.generic_hints))
# 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.
if not bool(self.hint_database):
......@@ -386,10 +388,13 @@ class CrowdsourceHinter(XBlock):
return [
("CrowdsourceHinter",
"""
<verticaldemo>
<crowdsourcehinter>
"Hello world."
<crowdsourcehinter/>
"""),
{"initial_hint_answer": "michigann", "initial_hint_text": "you have an extra n", "generic_hint": "make sure to chekc your spelling"}
</crowdsourcehinter>
</verticaldemo>
"""
),
]
@classmethod
......@@ -398,6 +403,7 @@ class CrowdsourceHinter(XBlock):
A minimal working test for parse_xml
"""
block = runtime.construct_xblock_from_class(cls, keys)
block = runtime.construct_xblock_from_class(cls, keys)
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
......@@ -3,7 +3,7 @@ function CrowdsourceHinter(runtime, element){
//If the code is not made to stop running, the hinter will act up after switching from and back to
//a certain unit.
var executeHinter = true;
$(".csh_HintQuickFeedback", element).hide();
$(".crowdsourcehinter_block", element).hide();
if(executeHinter){
var isShowingHintFeedback = false;
......@@ -30,7 +30,7 @@ function CrowdsourceHinter(runtime, element){
//This function will determine whether or not the student correctly answered the question.
//If it was correctly answered it will begin the process for giving feedback on hints.
if (problem_graded_event_data[1].search(/class="correct/) === -1){
$(".csh_HintQuickFeedback", element).show();
$(".crowdsourcehinter_block", element).show();
$.ajax({
type: "POST",
url: runtime.handlerUrl(element, 'get_hint'),
......
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