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
4ad9860b
Commit
4ad9860b
authored
Nov 10, 2014
by
Sola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving to templates
parent
8ec8332f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
71 deletions
+47
-71
crowdsourcehinter/crowdsourcehinter.py
+3
-20
crowdsourcehinter/static/css/crowdsourcehinter.css
+9
-0
crowdsourcehinter/static/html/crowdsourcehinter.html
+35
-51
crowdsourcehinter/static/js/src/crowdsourcehinter.js
+0
-0
No files found.
crowdsourcehinter/crowdsourcehinter.py
View file @
4ad9860b
...
@@ -295,21 +295,17 @@ class CrowdsourceHinter(XBlock):
...
@@ -295,21 +295,17 @@ class CrowdsourceHinter(XBlock):
@XBlock.json_handler
@XBlock.json_handler
def
rate_hint
(
self
,
data
,
suffix
=
''
):
def
rate_hint
(
self
,
data
,
suffix
=
''
):
"""
"""
Used to facilitate hint rating by students. Ratings are -1, 1, or 0. -1 is downvote, 1 is upvote, and 0 is
Used to facilitate hint rating by students.
when a student flags a hint. 'zzeerroo' is returned to JS when a hint's rating is 0 because whenever 0 was
simply returned, JS would interpret it as null.
Hint ratings in hint_database are updated and the resulting hint rating (or flagged status) is returned to JS.
Hint ratings in hint_database are updated and the resulting hint rating (or flagged status) is returned to JS.
Args:
Args:
data['student_answer']: The incorrect answer that corresponds to the hint that is being voted on
data['student_answer']: The incorrect answer that corresponds to the hint that is being voted on
data['hint']: The hint that is being voted on
data['hint']: The hint that is being voted on
data['student_rating']: The rating chosen by the student.
The value is -1, 1, or 0.
data['student_rating']: The rating chosen by the student.
Returns:
Returns:
"rating": The rating of the hint. 'zzeerroo' is returned if the hint's rating is 0.
"rating": The rating of the hint.
If the hint has already been voted on, 'You have already voted on this hint!'
will be returned to JS.
"""
"""
answer_data
=
data
[
'student_answer'
]
answer_data
=
data
[
'student_answer'
]
# answer_data is manipulated to remove symbols to prevent errors that
# answer_data is manipulated to remove symbols to prevent errors that
...
@@ -343,19 +339,6 @@ class CrowdsourceHinter(XBlock):
...
@@ -343,19 +339,6 @@ class CrowdsourceHinter(XBlock):
return
{
"rating"
:
str
(
rating
),
'hint'
:
data_hint
}
return
{
"rating"
:
str
(
rating
),
'hint'
:
data_hint
}
else
:
else
:
return
{
"rating"
:
str
(
'voted'
),
'hint'
:
data_hint
}
return
{
"rating"
:
str
(
'voted'
),
'hint'
:
data_hint
}
# def hint_flagged(self, data_hint, answer_data):
# """
# This is used to add a hint to the self.flagged dictionary. When a hint is returned with the rating
# of 0, it is considered to be flagged.
# Args:
# data_hint: This is equal to the data['hint'] in self.rate_hint
# answer_data: This is equal to the data['student_answer'] in self.rate_hint
# """
# for answer_keys in self.hint_database:
# if answer_keys == data_hint:
# for hint_keys in self.hint_database[str(answer_keys)]:
# if str(hint_keys) == answer_data:
self
.
Flagged
[
str
(
data_hint
)]
=
str
(
answer_data
)
self
.
Flagged
[
str
(
data_hint
)]
=
str
(
answer_data
)
def
change_rating
(
self
,
data_hint
,
data_rating
,
answer_data
):
def
change_rating
(
self
,
data_hint
,
data_rating
,
answer_data
):
...
...
crowdsourcehinter/static/css/crowdsourcehinter.css
View file @
4ad9860b
...
@@ -50,6 +50,15 @@ div[data-rate="downvote"] {
...
@@ -50,6 +50,15 @@ div[data-rate="downvote"] {
font-weight
:
bold
;
font-weight
:
bold
;
}
}
[
csh_isStaff
=
"false"
]
.csh_flagged_hints
{
visibility
:
hidden
;
display
:
none
;
}
[
csh_isStaff
=
"true"
]
.csh_flagged_hints
{
visibility
:
visible
;
}
.rating
{
.rating
{
margin-right
:
10px
;
margin-right
:
10px
;
}
}
...
...
crowdsourcehinter/static/html/crowdsourcehinter.html
View file @
4ad9860b
<script
type=
"x-tmpl-mustache"
id=
"show_hint_feedback"
>
<script
type=
'x-tmpl-mustache'
id=
'show_hint_feedback'
>
<
div
class
=
"hint_value"
value
=
{{
hintvalue
}}
>
<
div
class
=
'csh_hint_value'
value
=
{{
hintvalue
}}
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"upvote"
data
-
icon
=
"arrow-u"
aria
-
label
=
"upvote"
>
<
div
role
=
"button"
class
=
"
csh_
rate_hint"
data
-
rate
=
"upvote"
data
-
icon
=
"arrow-u"
aria
-
label
=
"upvote"
>
<
b
>
↑
<
/b
>
<
b
>
↑
<
/b
>
<
/div
>
<
/div
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"flag"
data
-
icon
=
"flag"
aria
-
label
=
"flag"
>
<
div
role
=
"button"
class
=
"
csh_
rate_hint"
data
-
rate
=
"flag"
data
-
icon
=
"flag"
aria
-
label
=
"flag"
>
<
b
>!<
/b
>
<
b
>!<
/b
>
<
/div
>
<
/div
>
<
div
class
=
"rating"
>
{{
rating
}}
<
/div
>
<
div
class
=
"
csh_
rating"
>
{{
rating
}}
<
/div
>
<
div
class
=
"hint"
>
{{
hint
}}
<
/div
>
<
div
class
=
"
csh_
hint"
>
{{
hint
}}
<
/div
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"downvote"
aria
-
label
=
"downvote"
>
<
div
role
=
"button"
class
=
"
csh_
rate_hint"
data
-
rate
=
"downvote"
aria
-
label
=
"downvote"
>
<
b
>
↓
<
/b
>
<
b
>
↓
<
/b
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
</script>
</script>
<script
type=
"text/template"
id=
"testing"
>
<script
type=
"x-tmpl-mustache"
id=
"show_flagged_feedback"
>
<
div
class
=
"csh_hint_value"
value
=
{{
hint
}}
>
<
div
role
=
"button"
class
=
"csh_staff_rate"
data
-
rate
=
"unflag"
aria
-
label
=
"unflag"
>
<
b
>
O
<
/b
>
<
/div
>
<
div
class
=
"csh_hint"
>
{{
hint
}}
<
/div
>
<
div
role
=
"button"
class
=
"csh_staff_rate"
data
-
rate
=
"remove"
aria
-
label
=
"remove"
>
<
b
>
X
<
/b
>
<
/div>
<
/div
>
</script>
<script
type=
"x-tmpl-mustache"
id=
"show_answer_feedback"
>
<
div
class
=
"csh_student_answer"
>
<
span
><
b
>
{{
answer
}}
<
/b></
span
>
<
div
>
<
div
>
{{
testone
}}
<
input
type
=
"button"
class
=
"csh_student_hint_creation"
value
=
"Submit a new hint for this answer."
{{
testtwo
}}
<
/input
>
<
/div
>
<
/div
>
<
/div
>
</script>
</script>
<div
class=
"crowdsourcehinter_block"
>
<!--most stuff just for testing purposes-->
<p>
<span
class=
'HintsToUse'
></span>
<div
class=
"crowdsourcehinter_block"
csh_isStaff=
false
>
<p>
<span
class=
'csh_HintsToUse'
></span>
</p>
</p>
</div>
<div
class=
"crowdsourcehinter_block"
>
<div
class=
"crowdsourcehinter_block"
>
<section
class=
"correct"
></section>
<section
class=
"c
sh_c
orrect"
></section>
<p>
<p>
<span
class=
'Thankyou'
></span>
<span
class=
'Thankyou'
></span>
</p>
</p>
<div
class=
"feedback"
>
<div
class=
"csh_feedback"
>
<script
type=
"x-tmpl-mustache"
id=
"show_hint_feedback"
>
<div
class=
"csh_flagged_hints"
>
<
div
class
=
"hint_value"
value
=
{{
hintvalue
}}
>
<span>
Flagged
</span>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"upvote"
data
-
icon
=
"arrow-u"
aria
-
label
=
"upvote"
>
</div>
<
b
>
↑
<
/b
>
</div>
<
/div
>
</div>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"flag"
data
-
icon
=
"flag"
aria
-
label
=
"flag"
>
<
b
>!<
/b
>
<
/div
>
<
div
class
=
"rating"
>
{{
rating
}}
<
/div
>
<
div
class
=
"hint"
>
{{
hint
}}
<
/div
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"downvote"
aria
-
label
=
"downvote"
>
<
b
>
↓
<
/b
>
<
/div
>
<
/div
>
</script>
</div>
</div>
<p>
</p>
<section
class=
"action"
>
<input
type=
"hidden"
name=
"problem_id"
value=
"Numerical Input"
>
<section
class=
"problem"
>
</div></section></span>
</section>
<section
class=
"crowdsource-wrapper"
>
</section>
</section>
</section>
</section>
crowdsourcehinter/static/js/src/crowdsourcehinter.js
View file @
4ad9860b
This diff is collapsed.
Click to expand it.
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