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
500b4baa
Commit
500b4baa
authored
Dec 29, 2014
by
solashirai
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added parsexml
parent
9e40db62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
crowdsourcehinter/crowdsourcehinter.py
+11
-15
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
500b4baa
...
...
@@ -21,7 +21,6 @@ class CrowdsourceHinter(XBlock):
"""
# Database of hints. hints are stored as such: {"incorrect_answer": {"hint": rating}}. each key (incorrect answer)
# has a corresponding dictionary (in which hints are keys and the hints' ratings are the values).
# TODO: Remove default values once done testing
hint_database
=
Dict
(
default
=
{},
scope
=
Scope
.
user_state_summary
)
# This is a list of incorrect answer submissions made by the student. this list is mostly used for
# feedback, to find which incorrect answer's hint a student voted on.
...
...
@@ -29,7 +28,8 @@ class CrowdsourceHinter(XBlock):
# A dictionary of default hints. default hints will be shown to students when there are no matches with the
# student's incorrect answer within the hint_database dictionary (i.e. no students have made hints for the
# particular incorrect answer)
DefaultHints
=
Dict
(
default
=
{},
scope
=
Scope
.
content
)
#
DefaultHints
=
List
(
default
=
[],
scope
=
Scope
.
content
)
# List of which hints have been shown to the student
# this list is used to prevent the same hint from showing up to a student (if they submit the same incorrect answers
# multiple times)
...
...
@@ -154,11 +154,8 @@ class CrowdsourceHinter(XBlock):
self
.
Used
.
append
(
not_used
)
return
{
'HintsToUse'
:
not_used
,
"StudentAnswer"
:
answer
}
else
:
temporary_hints_list
=
[]
for
hint_keys
in
self
.
DefaultHints
:
temporary_hints_list
.
append
(
str
(
hint_keys
))
if
len
(
temporary_hints_list
)
!=
0
:
not_used
=
random
.
choice
(
temporary_hints_list
)
if
len
(
self
.
DefaultHints
)
!=
0
:
not_used
=
random
.
choice
(
self
.
DefaultHints
)
self
.
Used
.
append
(
not_used
)
return
{
'HintsToUse'
:
not_used
,
"StudentAnswer"
:
answer
}
else
:
...
...
@@ -259,6 +256,7 @@ class CrowdsourceHinter(XBlock):
hint_rating
[
'student_answer'
]
=
data
[
'student_answer'
]
hint_rating
[
'hint'
]
=
data
[
'hint'
]
print
(
hint_rating
)
print
(
str
(
self
.
hint_database
))
return
hint_rating
@XBlock.json_handler
...
...
@@ -329,15 +327,15 @@ class CrowdsourceHinter(XBlock):
else
:
temporary_dictionary
[
str
(
data_hint
)]
-=
1
self
.
hint_database
[
str
(
answer_data
)]
=
temporary_dictionary
print
(
s
elf
.
hint_database
)
print
(
s
tr
(
self
.
hint_database
)
)
return
str
(
temporary_dictionary
[
str
(
data_hint
)])
@XBlock.json_handler
def
moderate_hint
(
self
,
data
,
suffix
=
''
):
"""
UNDER CONSTRUCTION, intended to be used for instructors to remove hints from the database after hints
have been flagged.
Under construction?
"""
print
(
"this is being used"
)
flagged_hints
=
{}
flagged_hints
=
self
.
Flagged
if
data
[
'rating'
]
==
"dismiss"
:
...
...
@@ -372,17 +370,18 @@ class CrowdsourceHinter(XBlock):
# self.hint_database equal to it due to being unable to directly
# edit self.hint_databse. Most likely scope error
self
.
hint_database
[
str
(
answer
)]
=
temporary_dictionary
print
(
str
(
self
.
hint_database
))
return
else
:
# if the hint exists already, simply upvote the previously entered hint
if
str
(
submission
)
in
self
.
DefaultHints
:
self
.
DefaultHints
[
str
(
submission
)]
+=
1
return
else
:
temporary_dictionary
=
str
(
self
.
hint_database
[
str
(
answer
)])
temporary_dictionary
=
(
ast
.
literal_eval
(
temporary_dictionary
))
temporary_dictionary
[
str
(
submission
)]
+=
1
self
.
hint_database
[
str
(
answer
)]
=
temporary_dictionary
print
(
str
(
self
.
hint_database
))
return
@XBlock.json_handler
...
...
@@ -410,9 +409,6 @@ class CrowdsourceHinter(XBlock):
"""
A minimal working test for parse_xml
"""
print
(
"parse xml is working"
)
block
=
runtime
.
construct_xblock_from_class
(
cls
,
keys
)
print
node
.
text
,
(
node
.
text
==
"Hello!"
)
block
.
show_best
=
(
node
.
text
==
"Hello!"
)
block
.
hint_databawse
=
{
"answer"
:
{
"xml test hint"
:
3
}}
block
.
DefaultHints
=
[
"Make sure to check your answer for basic mistakes like spelling!"
]
return
block
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