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 ast
import logging import logging
import operator import operator
import pkg_resources import pkg_resources
import random import random
import json
import hashlib
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
...@@ -116,6 +115,9 @@ class CrowdsourceHinter(XBlock): ...@@ -116,6 +115,9 @@ class CrowdsourceHinter(XBlock):
or another random hint for an incorrect answer or another random hint for an incorrect answer
or 'Sorry, there are no more hints for this answer.' if no more hints exist 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. # 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):
...@@ -385,11 +387,14 @@ class CrowdsourceHinter(XBlock): ...@@ -385,11 +387,14 @@ class CrowdsourceHinter(XBlock):
"""A canned scenario for display in the workbench.""" """A canned scenario for display in the workbench."""
return [ return [
("CrowdsourceHinter", ("CrowdsourceHinter",
""" """
<crowdsourcehinter> <verticaldemo>
"Hello world." <crowdsourcehinter>
<crowdsourcehinter/> {"initial_hint_answer": "michigann", "initial_hint_text": "you have an extra n", "generic_hint": "make sure to chekc your spelling"}
"""), </crowdsourcehinter>
</verticaldemo>
"""
),
] ]
@classmethod @classmethod
...@@ -398,6 +403,7 @@ class CrowdsourceHinter(XBlock): ...@@ -398,6 +403,7 @@ 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)
block = runtime.construct_xblock_from_class(cls, keys)
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!"]
block.initial_hints = {"michigann": {"You have an extra N in your answer": 1}} block.initial_hints = {"michigann": {"You have an extra N in your answer": 1}}
return block return block
...@@ -3,7 +3,7 @@ function CrowdsourceHinter(runtime, element){ ...@@ -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 //If the code is not made to stop running, the hinter will act up after switching from and back to
//a certain unit. //a certain unit.
var executeHinter = true; var executeHinter = true;
$(".csh_HintQuickFeedback", element).hide(); $(".crowdsourcehinter_block", element).hide();
if(executeHinter){ if(executeHinter){
var isShowingHintFeedback = false; var isShowingHintFeedback = false;
...@@ -30,7 +30,7 @@ function CrowdsourceHinter(runtime, element){ ...@@ -30,7 +30,7 @@ function CrowdsourceHinter(runtime, element){
//This function will determine whether or not the student correctly answered the question. //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 it was correctly answered it will begin the process for giving feedback on hints.
if (problem_graded_event_data[1].search(/class="correct/) === -1){ if (problem_graded_event_data[1].search(/class="correct/) === -1){
$(".csh_HintQuickFeedback", element).show(); $(".crowdsourcehinter_block", element).show();
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: runtime.handlerUrl(element, 'get_hint'), 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