Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crowdsourcehinter
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
crowdsourcehinter
Commits
5f6ec7f6
Commit
5f6ec7f6
authored
Jan 05, 2015
by
solashirai
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit for meeting
parent
f9dfc035
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
crowdsourcehinter/crowdsourcehinter.py
+14
-8
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+2
-2
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
5f6ec7f6
# 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
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
5f6ec7f6
...
@@ -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
;
$
(
".c
sh_HintQuickFeedba
ck"
,
element
).
hide
();
$
(
".c
rowdsourcehinter_blo
ck"
,
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
){
$
(
".c
sh_HintQuickFeedba
ck"
,
element
).
show
();
$
(
".c
rowdsourcehinter_blo
ck"
,
element
).
show
();
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'get_hint'
),
url
:
runtime
.
handlerUrl
(
element
,
'get_hint'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment