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
f4f3d78b
Commit
f4f3d78b
authored
Nov 01, 2014
by
Sola
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed git issues
parent
9a3b4626
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
18 deletions
+32
-18
crowdxblock/crowdxblock.py
+14
-14
crowdxblock/static/css/crowdxblock.css
+3
-3
crowdxblock/static/html/crowdxblock.html
+15
-1
crowdxblock/static/js/src/crowdxblock.js
+0
-0
No files found.
crowdxblock/crowdxblock.py
View file @
f4f3d78b
...
...
@@ -224,7 +224,7 @@ class CrowdXBlock(XBlock):
else
:
feedback_data
[
str
(
hints
)]
=
str
(
answer_keys
)
else
:
feedback_data
[
str
(
"There are no hints for"
+
" "
+
str
(
answer_keys
))
]
=
str
(
answer_keys
)
feedback_data
[
None
]
=
str
(
answer_keys
)
elif
len
(
self
.
WrongAnswers
)
==
0
:
return
else
:
...
...
@@ -254,7 +254,7 @@ class CrowdXBlock(XBlock):
self
.
Used
.
append
(
str
(
random_hint_key
))
else
:
self
.
no_hints
(
index
)
feedback_data
[
str
(
"There are no hints for"
+
" "
+
str
(
self
.
WrongAnswers
[
index
]))
]
=
str
(
self
.
WrongAnswers
[
index
])
feedback_data
[
None
]
=
str
(
self
.
WrongAnswers
[
index
])
self
.
WrongAnswers
=
[]
self
.
Used
=
[]
return
feedback_data
...
...
@@ -273,7 +273,7 @@ class CrowdXBlock(XBlock):
This function is used to return the ratings of hints during hint feedback.
data['student_answer'] is the answer for the hint being displayed
data['hint
_used
'] is the hint being shown to the student
data['hint'] is the hint being shown to the student
returns:
hint_rating: the rating of the hint as well as data on what the hint in question is
...
...
@@ -282,13 +282,13 @@ class CrowdXBlock(XBlock):
if
data
[
'student_answer'
]
==
'Flagged'
:
hint_rating
[
'rating'
]
=
0
hint_rating
[
'student_ansxwer'
]
=
'Flagged'
hint_rating
[
'hint
_used'
]
=
data
[
'hint_used
'
]
hint_rating
[
'hint
'
]
=
data
[
'hint
'
]
return
hint_rating
temporary_dictionary
=
str
(
self
.
hint_database
[
data
[
'student_answer'
]])
temporary_dictionary
=
(
ast
.
literal_eval
(
temporary_dictionary
))
hint_rating
[
'rating'
]
=
temporary_dictionary
[
data
[
'hint
_used
'
]]
hint_rating
[
'rating'
]
=
temporary_dictionary
[
data
[
'hint'
]]
hint_rating
[
'student_answer'
]
=
data
[
'student_answer'
]
hint_rating
[
'hint
_used'
]
=
data
[
'hint_used
'
]
hint_rating
[
'hint
'
]
=
data
[
'hint
'
]
return
hint_rating
@XBlock.json_handler
...
...
@@ -302,7 +302,7 @@ class CrowdXBlock(XBlock):
Args:
data['student_answer']: The incorrect answer that corresponds to the hint that is being voted on
data['
used_
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.
Returns:
...
...
@@ -314,7 +314,7 @@ class CrowdXBlock(XBlock):
# answer_data is manipulated to remove symbols to prevent errors that
# might arise due to certain symbols. I don't think I have this fully working but am not sure.
data_rating
=
data
[
'student_rating'
]
data_hint
=
data
[
'
used_
hint'
]
data_hint
=
data
[
'hint'
]
if
data
[
'student_rating'
]
==
'unflag'
:
for
flagged_hints
in
self
.
Flagged
:
if
self
.
Flagged
[
str
(
flagged_hints
)]
==
data_hint
:
...
...
@@ -332,23 +332,23 @@ class CrowdXBlock(XBlock):
if
data
[
'student_rating'
]
==
'flag'
:
# add hint to
self
.
Flagged
[
str
(
answer_data
)]
=
data_hint
return
{
"rating"
:
'flagged'
,
'
used_
hint'
:
data_hint
}
return
{
"rating"
:
'flagged'
,
'hint'
:
data_hint
}
if
str
(
data_hint
)
not
in
self
.
Voted
:
self
.
Voted
.
append
(
str
(
data_hint
))
# add data to Voted to prevent multiple votes
rating
=
self
.
change_rating
(
data_hint
,
data_rating
,
answer_data
)
# change hint rating
if
str
(
rating
)
==
str
(
0
):
return
{
"rating"
:
str
(
0
),
'
used_
hint'
:
data_hint
}
return
{
"rating"
:
str
(
0
),
'hint'
:
data_hint
}
else
:
return
{
"rating"
:
str
(
rating
),
'
used_
hint'
:
data_hint
}
return
{
"rating"
:
str
(
rating
),
'hint'
:
data_hint
}
else
:
return
{
"rating"
:
str
(
'voted'
),
'
used_
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['
used_
hint'] in self.rate_hint
# 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:
...
...
@@ -364,7 +364,7 @@ class CrowdXBlock(XBlock):
in self.rate_hint
Args:
data_hint: This is equal to the data['
used_
hint'] in self.rate_hint
data_hint: This is equal to the data['hint'] in self.rate_hint
data_rating: This is equal to the data['student_rating'] in self.rate_hint
answer_data: This is equal to the data['student_answer'] in self.rate_hint
...
...
crowdxblock/static/css/crowdxblock.css
View file @
f4f3d78b
...
...
@@ -35,17 +35,17 @@
margin-right
:
auto
;
}
d
2
[
data-rate
=
"flag"
]
{
d
iv
[
data-rate
=
"flag"
]
{
align-self
:
flex-end
;
}
d
1
[
data-rate
=
"upvote"
]
{
d
iv
[
data-rate
=
"upvote"
]
{
color
:
green
;
font-weight
:
bold
;
margin-right
:
15px
;
}
d
5
[
data-rate
=
"downvote"
]
{
d
iv
[
data-rate
=
"downvote"
]
{
color
:
red
;
font-weight
:
bold
;
}
...
...
crowdxblock/static/html/crowdxblock.html
View file @
f4f3d78b
<script
type=
"x-tmpl-mustache"
id=
"show_hint_feedback"
>
<
div
class
=
"hint_value"
value
=
{{
hint
}}
>
<
div
role
=
"button"
class
=
"rate_hint"
data
-
rate
=
"upvote"
data
-
icon
=
"arrow-u"
aria
-
label
=
"upvote"
>
<
b
>
↑
<
/b
>
<
/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
class=
"crowdxblock_block"
>
<!--most stuff just for testing purposes-->
<p>
<span
class=
'HintsToUse'
></span>
...
...
crowdxblock/static/js/src/crowdxblock.js
View file @
f4f3d78b
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