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
5941f291
Commit
5941f291
authored
Sep 14, 2014
by
Sola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed hint rating
parent
0f434b41
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
crowdxblock/crowdxblock.py
+4
-3
crowdxblock/static/js/src/crowdxblock.js
+4
-3
No files found.
crowdxblock/crowdxblock.py
View file @
5941f291
...
...
@@ -256,16 +256,17 @@ class CrowdXBlock(XBlock):
# if student flagged hint
self
.
hint_flagged
(
data
[
'used_hint'
],
answer_data
)
return
{
"rating"
:
'thiswasflagged'
,
'origdata'
:
original_data
}
print
(
str
(
self
.
Voted
))
if
str
(
answer_data
)
not
in
self
.
Voted
:
self
.
Voted
.
append
(
str
(
answer_data
))
# add data to Voted to prevent multiple votes
rating
=
self
.
change_rating
(
data_hint
,
int
(
data_rating
),
answer_data
)
# change hint rating
if
str
(
rating
)
==
str
(
0
):
# if the rating is "0", return "zzeerroo" instead. "0" showed up as "null" in JS
return
{
"rating"
:
str
(
'zzeerroo'
),
'
student_answer'
:
original_data
}
return
{
"rating"
:
str
(
'zzeerroo'
),
'
used_hint'
:
data_hint
}
else
:
return
{
"rating"
:
str
(
rating
),
'
student_answer'
:
original_data
}
return
{
"rating"
:
str
(
rating
),
'
used_hint'
:
data_hint
}
else
:
return
{
"rating"
:
str
(
'You have already voted on this hint!'
),
'
student_answer'
:
original_data
}
return
{
"rating"
:
str
(
'You have already voted on this hint!'
),
'
used_hint'
:
data_hint
}
def
hint_flagged
(
self
,
data_hint
,
answer_data
):
"""
...
...
crowdxblock/static/js/src/crowdxblock.js
View file @
5941f291
...
...
@@ -131,7 +131,7 @@ function CrowdXBlock(runtime, element){
HintShown
.
push
(
index
);}
}
else
{
if
(
$
.
inArray
(
index
,
HintShown
)
==
-
1
){
console
.
log
(
'
YIESSSSS'
);
console
.
log
(
'
index is is'
+
indexid
);
$
(
'#hintstoshow'
+
valueid
).
prepend
(
"<p
\"
id =
\"
thisparagraph"
+
indexid
+
"
\"
>"
+
"<span style=
\"
display: inline-block;
\"
><input data-value=
\"
"
+
valueid
+
"
\"
id=
\"
"
+
indexid
+
"
\"
type=
\"
button
\"
style=
\"
padding-top: 3px;width:20px; height:35px;
\"
class=
\"
hintbutton
\"
data-rate=
\"
1
\"
value=
\"
^
\"
><input data-value=
\"
"
+
valueid
+
"
\"
id=
\"
"
+
indexid
+
"
\"
style=
\"
padding-top: 3px;width:20px; height:35px;
\"
type=
\"
button
\"
class=
\"
hintbutton
\"
data-rate=
\"
-1
\"
value=
\"
v
\"
><input data-value=
\"
"
+
valueid
+
"
\"
style=
\"
padding-top: 3px;width:20px; height:35px;
\"
id=
\"
"
+
indexid
+
"
\"
type=
\"
button
\"
class=
\"
hintbutton
\"
data-rate=
\"
0
\"
value=
\"
!
\"
></span><font color=
\"
blue
\"
>"
+
index
+
"</font></p>"
);
HintShown
.
push
(
index
);
}}}
else
{
...
...
@@ -197,7 +197,7 @@ function CrowdXBlock(runtime, element){
$
.
ajax
({
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'rate_hint'
),
data
:
JSON
.
stringify
({
"student_rating"
:
$
(
this
).
attr
(
'data-rate'
),
"
student_answer"
:
$
(
this
).
attr
(
'id'
),
"used_hint
"
:
$
(
this
).
attr
(
'data-value'
)}),
data
:
JSON
.
stringify
({
"student_rating"
:
$
(
this
).
attr
(
'data-rate'
),
"
used_hint"
:
$
(
this
).
attr
(
'id'
),
"student_answer
"
:
$
(
this
).
attr
(
'data-value'
)}),
success
:
finish
});})
...
...
@@ -206,7 +206,8 @@ function CrowdXBlock(runtime, element){
if
(
canhint
==
0
){
canhint
=
1
;
$
(
'.Thankyou'
,
element
).
text
(
"Thankyou for your help!"
);
idtouse
=
String
(
'thisparagraph'
+
result
.
student_answer
);
idtouse
=
String
(
'thisparagraph'
+
result
.
used_hint
);
console
.
log
(
idtouse
)
hint_rating
=
result
.
rating
;
if
(
result
.
rating
==
"zzeerroo"
){
hint_rating
=
0
;
...
...
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