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
e597f911
Commit
e597f911
authored
May 03, 2015
by
solashirai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes/improvement to UX
parent
80afc470
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
8 deletions
+22
-8
crowdsourcehinter/crowdsourcehinter.py
+2
-3
crowdsourcehinter/static/css/crowdsourcehinter.css
+10
-1
crowdsourcehinter/static/html/crowdsourcehinter.html
+7
-4
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+3
-0
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
e597f911
...
...
@@ -132,8 +132,6 @@ class CrowdsourceHinter(XBlock):
remaining_hints
=
str
(
self
.
find_hints
(
answer
))
if
remaining_hints
!=
str
(
0
):
for
hint
in
self
.
hint_database
[
str
(
answer
)]:
print
hint
,
self
.
reported_hints
.
keys
()
print
str
(
self
.
reported_hints
)
if
hint
not
in
self
.
reported_hints
.
keys
():
#if best_hint hasn't been set yet or the rating of hints is greater than the rating of best_hint
if
(
best_hint
==
""
or
self
.
hint_database
[
str
(
answer
)][
hint
]
>
self
.
hint_database
[
str
(
answer
)][
str
(
best_hint
)]):
...
...
@@ -231,7 +229,6 @@ class CrowdsourceHinter(XBlock):
answer_data
=
data
[
'student_answer'
]
data_rating
=
data
[
'student_rating'
]
data_hint
=
data
[
'hint'
]
print
data_rating
,
answer_data
if
data
[
'student_rating'
]
==
'unreport'
:
for
reported_hints
in
self
.
reported_hints
:
if
reported_hints
==
data_hint
:
...
...
@@ -265,6 +262,8 @@ class CrowdsourceHinter(XBlock):
The rating associated with the hint is returned. This rating is identical
to what would be found under self.hint_database[answer_string[hint_string]]
"""
if
any
(
data_hint
in
generic_hints
for
generic_hints
in
self
.
generic_hints
):
return
if
data_rating
==
'upvote'
:
self
.
hint_database
[
str
(
answer_data
)][
str
(
data_hint
)]
+=
1
else
:
...
...
crowdsourcehinter/static/css/crowdsourcehinter.css
View file @
e597f911
...
...
@@ -39,7 +39,7 @@
align-self
:
flex-end
;
}
.csh_rate_hint
,
.csh_report_hint
,
.csh_rate_hint_completed
{
.csh_rate_hint
,
.csh_report_hint
,
.csh_rate_hint_completed
,
.csh_rate_hint_text
{
margin-right
:
15px
;
margin-top
:
5px
;
align-self
:
flex-end
;
...
...
@@ -59,6 +59,15 @@ background-clip: padding-box;
font-size
:
0.8125em
;
}
.csh_hint_text
[
rating
=
"upvote"
]
{
color
:
green
;
}
.csh_hint_text
[
rating
=
"downvote"
]
{
color
:
red
;
}
.csh_rate_hint
[
data-rate
=
"upvote"
]
{
color
:
green
;
font-weight
:
bold
;
...
...
crowdsourcehinter/static/html/crowdsourcehinter.html
View file @
e597f911
<script
type=
'x-tmpl/mustache'
id=
'show_hint_rating_ux'
>
<
div
class
=
'csh_hint_value'
value
=
"{{hintText}}"
>
<
div
class
=
'csh_hint_data'
>
<
div
class
=
"csh_hint"
><
b
>
{{
hintText
}}
<
/b></
div
>
<
div
class
=
"csh_hint"
>
Your
original
hint
was
:
<
b
>
{{
hintText
}}
<
/b></
div
>
<
/div
>
<
div
class
=
'csh_rating_data'
>
<
div
role
=
"button"
class
=
"csh_rate_hint"
data
-
rate
=
"upvote"
>
...
...
@@ -62,14 +62,17 @@
<div
class=
"crowdsourcehinter_block"
>
<div
class=
'csh_hint_reveal'
>
<div
class=
'csh_hint_text'
student_answer =
''
hint_received=
''
>
<div
class=
'csh_hint_text'
student_answer =
''
hint_received=
''
rating=
''
>
</div>
<div
class=
'csh_hint_rating_on_incorrect'
>
<div
class=
"csh_rate_hint_text"
>
Rate this hint:
</div>
<div
role=
"button"
class=
"csh_rate_hint"
data-rate=
"upvote"
title=
"This hint was helpful!"
>
<b>
+
</b>
<b>
Helpful
</b>
</div>
<div
role=
"button"
class=
"csh_rate_hint"
data-rate=
"downvote"
title=
"This hint was not very helpful."
>
<b>
-
</b>
<b>
Unhelpful
</b>
</div>
<div
role=
"button"
class=
"csh_report_hint"
title=
"Report this hint"
>
<b>
⚑
</b>
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
e597f911
...
...
@@ -95,6 +95,8 @@ function CrowdsourceHinter(runtime, element, data){
$
(
'.csh_hint_text'
,
element
).
attr
(
'student_answer'
,
result
.
StudentAnswer
);
$
(
'.csh_hint_text'
,
element
).
attr
(
'hint_received'
,
result
.
BestHint
);
$
(
'.csh_hint_text'
,
element
).
text
(
"Hint: "
+
result
.
BestHint
);
$
(
'.csh_rate_hint_completed'
,
element
).
attr
(
'class'
,
'csh_rate_hint'
);
$
(
'.csh_hint_text'
,
element
).
attr
(
'rating'
,
''
);
Logger
.
log
(
'crowd_hinter.showHint'
,
{
"student_answer"
:
result
.
StudentAnswer
,
"hint_received"
:
result
.
Hints
});
}
...
...
@@ -224,6 +226,7 @@ function CrowdsourceHinter(runtime, element, data){
*/
function
rate_hint
(){
return
function
(
rateHintButtonHTML
){
rating
=
rateHintButtonHTML
.
currentTarget
.
attributes
[
'data-rate'
].
value
;
$
(
'.csh_hint_text'
,
element
).
attr
(
'rating'
,
rating
);
hint
=
$
(
'.csh_hint_text'
,
element
).
attr
(
'hint_received'
);
student_answer
=
$
(
'.csh_hint_text'
,
element
).
attr
(
'student_answer'
);
$
.
ajax
({
...
...
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