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
c3b407ba
Commit
c3b407ba
authored
Sep 21, 2014
by
Sola
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show only the best hint
parent
fd9a6500
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
crowdxblock/crowdxblock.py
+19
-8
No files found.
crowdxblock/crowdxblock.py
View file @
c3b407ba
...
@@ -44,6 +44,10 @@ class CrowdXBlock(XBlock):
...
@@ -44,6 +44,10 @@ class CrowdXBlock(XBlock):
# values are the hints the corresponding hints. even if a hint is flagged, if the hint shows up for a different
# values are the hints the corresponding hints. even if a hint is flagged, if the hint shows up for a different
# incorrect answer, i believe that the hint will still be able to show for a student
# incorrect answer, i believe that the hint will still be able to show for a student
Flagged
=
Dict
(
default
=
{},
scope
=
Scope
.
user_state_summary
)
Flagged
=
Dict
(
default
=
{},
scope
=
Scope
.
user_state_summary
)
# This string determines whether or not to show only the best (highest rated) hint to a student
# When set to 'True' only the best hint will be shown to the student.
# Details on operation when set to 'False' are to be finalized.
show_best
=
Dict
(
default
=
{
'showbest'
:
'True'
},
scope
=
Scope
.
user_state_summary
)
def
student_view
(
self
,
context
=
None
):
def
student_view
(
self
,
context
=
None
):
"""
"""
...
@@ -105,14 +109,21 @@ class CrowdXBlock(XBlock):
...
@@ -105,14 +109,21 @@ class CrowdXBlock(XBlock):
found_equal_sign
=
1
found_equal_sign
=
1
eqplace
=
answer
.
index
(
"="
)
+
1
eqplace
=
answer
.
index
(
"="
)
+
1
answer
=
answer
[
eqplace
:]
answer
=
answer
[
eqplace
:]
print
(
'***********************************************************************'
)
print
str
(
self
.
show_best
)
best_hint
=
max
(
self
.
hint_database
[
str
(
answer
)]
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
if
self
.
show_best
[
'showbest'
]
==
'True'
:
if
best_hint
not
in
self
.
Flagged
.
keys
():
self
.
Used
.
append
(
best_hint
)
return
{
'HintsToUse'
:
best_hint
}
remaining_hints
=
str
(
self
.
find_hints
(
answer
))
remaining_hints
=
str
(
self
.
find_hints
(
answer
))
if
remaining_hints
!=
str
(
0
):
if
remaining_hints
!=
str
(
0
):
print
str
(
self
.
hint_database
[
str
(
answer
)])
print
str
(
self
.
hint_database
[
str
(
answer
)])
if
max
(
self
.
hint_database
[
str
(
answer
)]
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
not
in
self
.
Used
:
if
best_hint
not
in
self
.
Used
:
# choose highest rated hint for the incorrect answer
# choose highest rated hint for the incorrect answer
if
max
(
self
.
hint_database
[
str
(
answer
)]
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
not
in
self
.
Flagged
.
keys
():
if
best_hint
not
in
self
.
Flagged
.
keys
():
self
.
Used
.
append
(
max
(
self
.
hint_database
[
str
(
answer
)]
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
)
self
.
Used
.
append
(
best_hint
)
return
{
'HintsToUse'
:
max
(
self
.
hint_database
[
str
(
answer
)]
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
}
return
{
'HintsToUse'
:
best_hint
}
else
:
else
:
# choose another random hint for the answer.
# choose another random hint for the answer.
temporary_hints_list
=
[]
temporary_hints_list
=
[]
...
@@ -124,11 +135,11 @@ class CrowdXBlock(XBlock):
...
@@ -124,11 +135,11 @@ class CrowdXBlock(XBlock):
temporary_hints_list
.
append
(
str
(
hint_keys
))
temporary_hints_list
.
append
(
str
(
hint_keys
))
not_used
=
random
.
choice
(
temporary_hints_list
)
not_used
=
random
.
choice
(
temporary_hints_list
)
else
:
else
:
if
max
(
self
.
DefaultHints
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
not
in
self
.
Used
:
if
best_hint
not
in
self
.
Used
:
# choose highest rated hint for the incorrect answer
# choose highest rated hint for the incorrect answer
if
max
(
self
.
DefaultHints
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
not
in
self
.
Flagged
.
keys
():
if
best_hint
not
in
self
.
Flagged
.
keys
():
self
.
Used
.
append
(
max
(
self
.
DefaultHints
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
)
self
.
Used
.
append
(
best_hint
)
return
{
'HintsToUse'
:
max
(
self
.
DefaultHints
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
}
return
{
'HintsToUse'
:
best_hint
}
else
:
else
:
temporary_hints_list
=
[]
temporary_hints_list
=
[]
for
hint_keys
in
self
.
DefaultHints
:
for
hint_keys
in
self
.
DefaultHints
:
...
...
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