Commit 132ad676 by Piotr Mitros

Merge pull request #5 from solashirai/pmitros/code-review-2

Code quality cleanup, following Ned's code review.
parents 2ca1629b b3c346bf
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<sequential display_name="CSH With Settings" url_name="csh_settings_s"> <sequential display_name="CSH With Settings" url_name="csh_settings_s">
<vertical display_name="CSH With Settings" url_name="csh_settings_v"> <vertical display_name="CSH With Settings" url_name="csh_settings_v">
<problem url_name="michigan_problem_prehint"/> <problem url_name="michigan_problem_prehint"/>
<crowdsourcehinter Element="i4x://edX/CSH_Course/problem/sample_problem" <crowdsourcehinter target_problem="i4x://edX/CSH_Course/problem/sample_problem"
display_name="Unit" display_name="Unit"
generic_hints="[&quot;Try checking for spelling mistakes.&quot;]" generic_hints="[&quot;Try checking for spelling mistakes.&quot;]"
initial_hints="{&quot;michigann&quot;: &quot;Your answer has too many Ns.&quot;}" initial_hints="{&quot;michigann&quot;: &quot;Your answer has too many Ns.&quot;}"
......
...@@ -90,14 +90,14 @@ function CrowdsourceHinter(runtime, element, data){ ...@@ -90,14 +90,14 @@ function CrowdsourceHinter(runtime, element, data){
* Set the target problem for which to listen for the problem_graded event. Set target to first * Set the target problem for which to listen for the problem_graded event. Set target to first
* problem block if no hinting element has been manually entered. * problem block if no hinting element has been manually entered.
*/ */
if(data.hinting_element == undefined || data.hinting_element == ''){ if(data.target_problem == undefined || data.target_problem == ''){
//contains workaround because the data-usage-id shows up with ";_" in place of "/" in lms //contains workaround because the data-usage-id shows up with ";_" in place of "/" in lms
hintingElement = ($('.xblock[data-block-type="problem"]').first().attr('data-usage-id')).replace(/;_/g, '/'); targetProblem = ($('.xblock[data-block-type="problem"]').first().attr('data-usage-id')).replace(/;_/g, '/');
} else { } else {
hintingElement = data.hinting_element; targetProblem = data.target_problem;
} }
Logger.listen('problem_graded', hintingElement, onStudentSubmission()); Logger.listen('problem_graded', targetProblem, onStudentSubmission());
/** /**
* Modify csh_hint_text attributes to show hint to the student. * Modify csh_hint_text attributes to show hint to the student.
...@@ -219,7 +219,7 @@ function CrowdsourceHinter(runtime, element, data){ ...@@ -219,7 +219,7 @@ function CrowdsourceHinter(runtime, element, data){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: runtime.handlerUrl(element, 'add_new_hint'), url: runtime.handlerUrl(element, 'add_new_hint'),
data: JSON.stringify({"submission": newHint, "answer": studentAnswer}), data: JSON.stringify({"new_hint_submission": newHint, "answer": studentAnswer}),
success: function() { success: function() {
$('.csh_student_text_input', element).attr('style', 'display: none;'); $('.csh_student_text_input', element).attr('style', 'display: none;');
$(submitHintButtonHTML.currentTarget).attr('style', 'display: none;'); $(submitHintButtonHTML.currentTarget).attr('style', 'display: none;');
......
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