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
dfada058
Commit
dfada058
authored
Sep 29, 2014
by
Sola
Committed by
Piotr Mitros
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing variables and such for isstaff feedback
parent
dcdb7f36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
44 deletions
+20
-44
crowdxblock/crowdxblock.py
+18
-31
crowdxblock/static/js/src/crowdxblock.js
+2
-13
No files found.
crowdxblock/crowdxblock.py
View file @
dfada058
...
@@ -51,6 +51,7 @@ class CrowdXBlock(XBlock):
...
@@ -51,6 +51,7 @@ class CrowdXBlock(XBlock):
# will be shown. The method to actually determine whether or not the user is staff is not currently implemented.
# will be shown. The method to actually determine whether or not the user is staff is not currently implemented.
# TODO: make this into a boolean instead of a dict
# TODO: make this into a boolean instead of a dict
isStaff
=
Dict
(
default
=
{
'isStaff'
:
'true'
},
scope
=
Scope
.
user_state_summary
)
isStaff
=
Dict
(
default
=
{
'isStaff'
:
'true'
},
scope
=
Scope
.
user_state_summary
)
HintsToUse
=
Dict
({},
scope
=
Scope
.
user_state
)
def
student_view
(
self
,
context
=
None
):
def
student_view
(
self
,
context
=
None
):
"""
"""
...
@@ -163,7 +164,6 @@ class CrowdXBlock(XBlock):
...
@@ -163,7 +164,6 @@ class CrowdXBlock(XBlock):
"""
"""
isflagged
=
[]
isflagged
=
[]
isused
=
0
isused
=
0
testvar
=
0
self
.
WrongAnswers
.
append
(
str
(
answer
))
# add the student's input to the temporary list
self
.
WrongAnswers
.
append
(
str
(
answer
))
# add the student's input to the temporary list
if
str
(
answer
)
not
in
self
.
hint_database
:
if
str
(
answer
)
not
in
self
.
hint_database
:
# add incorrect answer to hint_database if no precedent exists
# add incorrect answer to hint_database if no precedent exists
...
@@ -175,8 +175,6 @@ class CrowdXBlock(XBlock):
...
@@ -175,8 +175,6 @@ class CrowdXBlock(XBlock):
isflagged
.
append
(
hint_keys
)
isflagged
.
append
(
hint_keys
)
if
str
(
hint_keys
)
in
self
.
Used
:
if
str
(
hint_keys
)
in
self
.
Used
:
isused
+=
1
isused
+=
1
for
hintkey
in
self
.
hint_database
[
str
(
answer
)]:
testvar
+=
1
if
(
len
(
self
.
hint_database
[
str
(
answer
)])
-
len
(
isflagged
)
-
isused
)
>
0
:
if
(
len
(
self
.
hint_database
[
str
(
answer
)])
-
len
(
isflagged
)
-
isused
)
>
0
:
return
str
(
1
)
return
str
(
1
)
else
:
else
:
...
@@ -199,11 +197,22 @@ class CrowdXBlock(XBlock):
...
@@ -199,11 +197,22 @@ class CrowdXBlock(XBlock):
# corresponding incorrect answer
# corresponding incorrect answer
feedback_data
=
{}
feedback_data
=
{}
number_of_hints
=
0
number_of_hints
=
0
if
self
.
isStaff
[
'isStaff'
]
==
'true'
:
feedback_data
=
get_staff_feedback
()
return
feedback_data
if
len
(
self
.
WrongAnswers
)
==
0
:
if
len
(
self
.
WrongAnswers
)
==
0
:
return
if
self
.
isStaff
[
'isStaff'
]
==
'false'
:
return
elif
self
.
isStaff
[
'isStaff'
]
==
'true'
:
for
answer_keys
in
self
.
hint_database
:
print
str
(
answer_keys
)
if
str
(
len
(
self
.
hint_database
[
str
(
answer_keys
)]))
!=
str
(
0
):
hint_key
=
self
.
hint_database
[
str
(
answer_keys
)]
.
keys
()
for
hints
in
hint_key
:
print
str
(
hints
)
if
str
(
hints
)
not
in
self
.
Flagged
.
keys
():
feedback_data
[
str
(
hints
)]
=
str
(
answer_keys
)
else
:
feedback_data
[
str
(
hints
)]
=
str
(
"Flagged Hints"
)
else
:
feedback_data
[
str
(
"There are no hints for"
+
" "
+
str
(
answer_keys
))]
=
str
(
answer_keys
)
else
:
else
:
for
index
in
range
(
0
,
len
(
self
.
Used
)):
for
index
in
range
(
0
,
len
(
self
.
Used
)):
# each index is a hint that was used, in order of usage
# each index is a hint that was used, in order of usage
...
@@ -234,6 +243,7 @@ class CrowdXBlock(XBlock):
...
@@ -234,6 +243,7 @@ class CrowdXBlock(XBlock):
feedback_data
[
str
(
"There are no hints for"
+
" "
+
str
(
self
.
WrongAnswers
[
index
]))]
=
str
(
self
.
WrongAnswers
[
index
])
feedback_data
[
str
(
"There are no hints for"
+
" "
+
str
(
self
.
WrongAnswers
[
index
]))]
=
str
(
self
.
WrongAnswers
[
index
])
self
.
WrongAnswers
=
[]
self
.
WrongAnswers
=
[]
self
.
Used
=
[]
self
.
Used
=
[]
print
str
(
feedback_data
)
return
feedback_data
return
feedback_data
def
no_hints
(
self
,
index
):
def
no_hints
(
self
,
index
):
...
@@ -241,31 +251,8 @@ class CrowdXBlock(XBlock):
...
@@ -241,31 +251,8 @@ class CrowdXBlock(XBlock):
This function is used when no hints exist for an answer. The feedback_data within
This function is used when no hints exist for an answer. The feedback_data within
get_feedback is set to "there are no hints for" + " " + str(self.WrongAnswers[index])
get_feedback is set to "there are no hints for" + " " + str(self.WrongAnswers[index])
"""
"""
self
.
WrongAnswers
.
append
(
str
(
self
.
WrongAnswers
[
index
]))
self
.
Used
.
append
(
str
(
"There are no hints for"
+
" "
+
str
(
self
.
WrongAnswers
[
index
])))
self
.
Used
.
append
(
str
(
"There are no hints for"
+
" "
+
str
(
self
.
WrongAnswers
[
index
])))
for
answer_keys
in
self
.
hint_database
:
if
str
(
len
(
self
.
hint_database
[
str
(
answer_keys
)]))
!=
str
(
0
):
hint_key
=
self
.
hint_database
[
str
(
answer_keys
)]
.
keys
()
for
hints
in
hint_key
:
if
str
(
hints
)
not
in
self
.
Flagged
.
keys
():
feedback_data
[
str
(
hints
)]
=
str
(
answer_keys
)
else
:
feedback_data
[
str
(
hints
)]
=
str
(
"Flagged Hint"
)
else
:
feedback_data
[
str
(
"There are no hints for"
+
" "
+
str
(
hint_key
))]
=
str
(
answer_keys
)
self
.
WrongAnswers
=
[]
self
.
Used
=
[]
return
feedback_data
def
get_staff_feedback
(
self
,
index
):
"""
This function is the alternative to get_feedback if the user is staff.
The method to determine whether or not the user is staff has not yet been implemented.
"""
# feedback_data is a dictionary of hints and corresponding answers
# The keys are the used hints, the values are the corresponding incorrect answer
# For flagged hints, the keys are used hints and the values are "flagged"
feedback_data
=
{}
@XBlock.json_handler
@XBlock.json_handler
def
get_ratings
(
self
,
data
,
suffix
=
''
):
def
get_ratings
(
self
,
data
,
suffix
=
''
):
...
...
crowdxblock/static/js/src/crowdxblock.js
View file @
dfada058
...
@@ -12,15 +12,6 @@ function CrowdXBlock(runtime, element){
...
@@ -12,15 +12,6 @@ function CrowdXBlock(runtime, element){
repeatcounter
+=
1
;
repeatcounter
+=
1
;
//use to determine whether or not to initialize hint feedback
//use to determine whether or not to initialize hint feedback
var
hasReceivedHint
=
false
;
var
hasReceivedHint
=
false
;
var
is_staff
=
false
;
var
check_staff
=
$
(
'#staffstatus'
).
val
();
if
(
check_staff
==
'staff view'
);
{
console
.
log
(
check_staff
);
console
.
log
(
"is_staff"
);
is_staff
=
true
;
}
Logger
.
listen
(
'seq_next'
,
null
,
clearingvariables
);
Logger
.
listen
(
'seq_next'
,
null
,
clearingvariables
);
Logger
.
listen
(
'seq_goto'
,
null
,
clearingvariables
);
Logger
.
listen
(
'seq_goto'
,
null
,
clearingvariables
);
...
@@ -58,7 +49,7 @@ function CrowdXBlock(runtime, element){
...
@@ -58,7 +49,7 @@ function CrowdXBlock(runtime, element){
success
:
seehint
success
:
seehint
});
});
hasReceivedHint
=
true
;
hasReceivedHint
=
true
;
}
else
if
(
hasReceivedHint
==
true
)
{
}
else
{
$
(
'.correct'
,
element
).
show
();
$
(
'.correct'
,
element
).
show
();
$
(
'.correct'
,
element
).
text
(
"You're correct! Please help us improve our hints by voting on them, or submit your own hint!"
);
$
(
'.correct'
,
element
).
text
(
"You're correct! Please help us improve our hints by voting on them, or submit your own hint!"
);
$
(
".HintsToUse"
,
element
).
text
(
" "
);
$
(
".HintsToUse"
,
element
).
text
(
" "
);
...
@@ -69,9 +60,7 @@ function CrowdXBlock(runtime, element){
...
@@ -69,9 +60,7 @@ function CrowdXBlock(runtime, element){
data
:
JSON
.
stringify
(
""
),
data
:
JSON
.
stringify
(
""
),
success
:
getFeedback
success
:
getFeedback
});
});
}
else
{
}
$
(
".HintsToUse"
,
element
).
text
(
""
);
}
}
}
function
seehint
(
result
){
function
seehint
(
result
){
...
...
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