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
ccedbd54
Commit
ccedbd54
authored
Dec 08, 2014
by
solashirai
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commiting prior to more UX changes
parent
24119b73
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
+18
-13
crowdsourcehinter/crowdsourcehinter.py
+8
-5
crowdsourcehinter/static/css/crowdsourcehinter.css
+8
-5
crowdsourcehinter/static/html/crowdsourcehinter.html
+2
-3
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
ccedbd54
...
...
@@ -132,14 +132,16 @@ class CrowdsourceHinter(XBlock):
if
remaining_hints
!=
str
(
0
):
best_hint
=
max
(
self
.
hint_database
[
str
(
answer
)]
.
iteritems
(),
key
=
operator
.
itemgetter
(
1
))[
0
]
if
self
.
show_best
[
'showbest'
]
==
'True'
:
# if set to show best, only the best hint will be shown. Different hitns will not be shown
# for multiple submissions/hint requests
if
best_hint
not
in
self
.
Flagged
.
keys
():
self
.
Used
.
append
(
best_hint
)
return
{
'HintsToUse'
:
best_hint
}
return
{
'HintsToUse'
:
best_hint
,
"StudentAnswer"
:
answer
}
if
best_hint
not
in
self
.
Used
:
# choose highest rated hint for the incorrect answer
if
best_hint
not
in
self
.
Flagged
.
keys
():
self
.
Used
.
append
(
best_hint
)
return
{
'HintsToUse'
:
best_hint
}
return
{
'HintsToUse'
:
best_hint
,
"StudentAnswer"
:
answer
}
else
:
# choose another random hint for the answer.
temporary_hints_list
=
[]
...
...
@@ -153,7 +155,7 @@ class CrowdsourceHinter(XBlock):
# choose highest rated hint for the incorrect answer
if
best_hint
not
in
self
.
Flagged
.
keys
():
self
.
Used
.
append
(
best_hint
)
return
{
'HintsToUse'
:
best_hint
}
return
{
'HintsToUse'
:
best_hint
,
"StudentAnswer"
:
answer
}
else
:
temporary_hints_list
=
[]
for
hint_keys
in
self
.
DefaultHints
:
...
...
@@ -164,7 +166,7 @@ class CrowdsourceHinter(XBlock):
else
:
# if there are no more hints left in either the database or defaults
self
.
Used
.
append
(
str
(
"There are no hints for"
+
" "
+
answer
))
return
{
'HintsToUse'
:
"Sorry, there are no more hints for this answer."
}
return
{
'HintsToUse'
:
"Sorry, there are no more hints for this answer."
,
"StudentAnswer"
:
answer
}
self
.
Used
.
append
(
not_used
)
return
{
'HintsToUse'
:
not_used
,
"StudentAnswer"
:
answer
}
...
...
@@ -287,7 +289,8 @@ class CrowdsourceHinter(XBlock):
hint_rating
[
'rating'
]
=
temporary_dictionary
[
data
[
'hint'
]]
hint_rating
[
'student_answer'
]
=
data
[
'student_answer'
]
hint_rating
[
'hint'
]
=
data
[
'hint'
]
return
hint_rating
print
(
hint_rating
)
return
hint_rating
@XBlock.json_handler
def
rate_hint
(
self
,
data
,
suffix
=
''
):
...
...
crowdsourcehinter/static/css/crowdsourcehinter.css
View file @
ccedbd54
...
...
@@ -27,7 +27,13 @@
.csh_hint_reveal
{
display
:
flex
;
flex-direction
:
column
;
}
.csh_HintQuickFeedback
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
flex-end
;
}
.csh_hint_data
{
...
...
@@ -38,19 +44,16 @@
}
.csh_rate_hint
{
width
:
100%
;
margin-left
:
auto
;
margin-right
:
auto
;
margin-right
:
15px
;
}
div
[
data-rate
=
"flag"
]
{
align-self
:
flex-en
d
;
font-weight
:
bol
d
;
}
div
[
data-rate
=
"upvote"
]
{
color
:
green
;
font-weight
:
bold
;
margin-right
:
15px
;
}
div
[
data-rate
=
"downvote"
]
{
...
...
crowdsourcehinter/static/html/crowdsourcehinter.html
View file @
ccedbd54
...
...
@@ -54,10 +54,9 @@
<div
class=
"crowdsourcehinter_block"
>
<div
class=
'csh_hint_reveal'
>
<div>
<span
class=
'csh_HintsToUse'
student_answer =
''
></span>
<div
class=
'csh_HintsToUse'
student_answer =
''
>
</div>
<div>
<div
class=
'csh_HintQuickFeedback'
>
<div
role=
"button"
class=
"csh_rate_hint"
data-rate=
"upvote"
data-icon=
"arrow-u"
aria-label=
"upvote"
>
<b>
↑
</b>
</div>
...
...
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