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
b88e5287
Commit
b88e5287
authored
May 18, 2015
by
solashirai
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test push
parent
a151e638
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
14 deletions
+31
-14
crowdsourcehinter/crowdsourcehinter.py
+9
-2
crowdsourcehinter/static/css/crowdsourcehinter.css
+21
-10
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+0
-1
crowdsourcehinter/static/js/src/crowdsourcehinter_studio.js
+1
-1
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
b88e5287
...
...
@@ -144,9 +144,10 @@ class CrowdsourceHinter(XBlock):
data['submittedanswer']: The string of text that the student submits for a problem.
returns:
'
b
estHint': the highest rated hint for an incorrect answer
'
B
estHint': the highest rated 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
'StudentAnswer': the student's incorrect answer
"""
# 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.
...
...
@@ -185,7 +186,7 @@ class CrowdsourceHinter(XBlock):
else
:
# if there are no hints in either the database or generic hints
self
.
used
.
append
(
str
(
"There are no hints for"
+
" "
+
answer
))
return
{
'
Hints
'
:
"Sorry, there are no hints for this answer."
,
"StudentAnswer"
:
answer
}
return
{
'
BestHint
'
:
"Sorry, there are no hints for this answer."
,
"StudentAnswer"
:
answer
}
def
find_hints
(
self
,
answer
):
"""
...
...
@@ -264,6 +265,10 @@ class CrowdsourceHinter(XBlock):
data['student_answer']: The incorrect answer that corresponds to the hint that is being rated
data['hint']: The hint that is being rated
data['student_rating']: The rating chosen by the student.
Returns:
'rating': the new rating of the hint, or the string 'reported' if the hint was reported
'hint': the hint that had its rating changed
"""
answer_data
=
data
[
'student_answer'
]
data_rating
=
data
[
'student_rating'
]
...
...
@@ -305,8 +310,10 @@ class CrowdsourceHinter(XBlock):
return
if
data_rating
==
'upvote'
:
self
.
hint_database
[
str
(
answer_data
)][
str
(
data_hint
)]
+=
1
return
self
.
hint_database
[
str
(
answer_data
)][
str
(
data_hint
)]
else
:
self
.
hint_database
[
str
(
answer_data
)][
str
(
data_hint
)]
-=
1
return
self
.
hint_database
[
str
(
answer_data
)][
str
(
data_hint
)]
@XBlock.json_handler
def
add_new_hint
(
self
,
data
,
suffix
=
''
):
...
...
crowdsourcehinter/static/css/crowdsourcehinter.css
View file @
b88e5287
...
...
@@ -27,6 +27,7 @@
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
flex-shrink
:
0
;
}
.csh_hint_data
{
...
...
@@ -38,6 +39,7 @@
display
:
flex
;
flex-direction
:
row
;
align-self
:
flex-end
;
flex-shrink
:
0
;
}
.csh_rate_hint
,
.csh_report_hint
,
.csh_rate_hint_completed
,
.csh_rate_hint_text
{
...
...
@@ -55,27 +57,36 @@ div[data-rate="report"]{
font-weight
:
600
;
align-self
:
flex-end
;
box-shadow
:
0px
0px
8px
4px
#C7BEBE
inset
,
0px
0px
8px
4px
#C7BEBE
inset
;
background-clip
:
padding-box
;
font-size
:
0.8125em
;
background-clip
:
padding-box
;
font-size
:
0.8125em
;
}
.csh_
hint_text
[
rating
=
"upvote"
]
{
.csh_
rate_hint
[
data-rate
=
"upvote"
]
{
color
:
green
;
font-weight
:
bold
;
transition
:
background
.4s
ease-in
}
.csh_rate_hint
[
data-rate
=
"upvote"
]
:hover
{
background-color
:
#BCBCBC
;
}
.csh_
hint_text
[
rating
=
"downvote"
]
{
.csh_
rate_hint
[
data-rate
=
"downvote"
]
{
color
:
red
;
font-weight
:
bold
;
transition
:
background
.4s
ease-in
}
.csh_rate_hint
[
data-rate
=
"downvote"
]
:hover
{
background-color
:
#BCBCBC
;
}
.csh_rate_hint
[
data-rate
=
"upvote"
]
{
color
:
green
;
font-weight
:
bold
;
.csh_report_hint
{
transition
:
background
.4s
ease-in
}
.csh_rate_hint
[
data-rate
=
"downvote"
]
{
color
:
red
;
font-weight
:
bold
;
.csh_report_hint
:hover
{
background-color
:
#BCBCBC
;
}
.csh_reported_hints
{
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
b88e5287
...
...
@@ -187,7 +187,6 @@ function CrowdsourceHinter(runtime, element, data){
$
(
'.csh_submit_new'
,
element
).
remove
();
$
(
createTextInputButtonHTML
.
currentTarget
).
hide
();
student_answer
=
$
(
'.csh_answer_text'
,
element
).
attr
(
'answer'
);
console
.
log
(
student_answer
);
var
hintTextInputTemplate
=
$
(
Mustache
.
render
(
$
(
'#hint_text_input'
).
html
(),
{
student_answer
:
student_answer
}));
$
(
'.csh_answer_text'
,
element
).
append
(
hintTextInputTemplate
);
}}
...
...
crowdsourcehinter/static/js/src/crowdsourcehinter_studio.js
View file @
b88e5287
...
...
@@ -28,7 +28,7 @@ function CrowdsourceHinterStudio(runtime, element, data){
}
else
{
$
(
'.csh_check_success'
,
element
).
text
(
'there was a problem adding your hints to the database. check the format on your hints.'
);
}
Logger
.
log
(
'crowd_hinter.staff_edit_hinter'
,
{
"generic_hints"
:
initial
,
"initial_hint"
:
generic
,
"element"
:
hinting_element
,
"successfully_set_hints"
:
result
.
success
});
Logger
.
log
(
'crowd_hinter.staff_edit_hinter'
,
{
"generic_hints"
:
generic
,
"initial_hint"
:
initial
,
"element"
:
hinting_element
,
"successfully_set_hints"
:
result
.
success
});
}
});
}}
...
...
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