Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
7a1ef62e
Commit
7a1ef62e
authored
May 09, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do some code reformatting
parent
8c12eb78
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
28 deletions
+28
-28
common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py
+7
-7
common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py
+6
-6
common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
+15
-15
No files found.
common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py
View file @
7a1ef62e
...
...
@@ -191,7 +191,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
}
(
error
,
msg
)
=
qinterface
.
send_to_queue
(
header
=
xheader
,
body
=
json
.
dumps
(
contents
))
body
=
json
.
dumps
(
contents
))
#Convert error to a success value
success
=
True
...
...
@@ -225,8 +225,8 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
str
(
len
(
self
.
child_history
)))
xheader
=
xqueue_interface
.
make_xheader
(
lms_callback_url
=
system
.
xqueue
[
'construct_callback'
](),
lms_key
=
queuekey
,
queue_name
=
self
.
queue_name
)
lms_key
=
queuekey
,
queue_name
=
self
.
queue_name
)
contents
=
self
.
payload
.
copy
()
...
...
@@ -244,7 +244,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
# Submit request. When successful, 'msg' is the prior length of the queue
qinterface
.
send_to_queue
(
header
=
xheader
,
body
=
json
.
dumps
(
contents
))
body
=
json
.
dumps
(
contents
))
# State associated with the queueing request
queuestate
=
{
'key'
:
queuekey
,
...
...
@@ -402,7 +402,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
if
not
response_items
[
'success'
]:
return
system
.
render_template
(
"{0}/open_ended_error.html"
.
format
(
self
.
TEMPLATE_DIR
),
{
'errors'
:
feedback
})
{
'errors'
:
feedback
})
feedback_template
=
system
.
render_template
(
"{0}/open_ended_feedback.html"
.
format
(
self
.
TEMPLATE_DIR
),
{
'grader_type'
:
response_items
[
'grader_type'
],
...
...
@@ -546,7 +546,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
return
""
feedback_dict
=
self
.
_parse_score_msg
(
self
.
child_history
[
-
1
]
.
get
(
'post_assessment'
,
""
),
system
,
join_feedback
=
join_feedback
)
join_feedback
=
join_feedback
)
if
not
short_feedback
:
return
feedback_dict
[
'feedback'
]
if
feedback_dict
[
'valid'
]
else
''
if
feedback_dict
[
'valid'
]:
...
...
@@ -711,7 +711,7 @@ class OpenEndedDescriptor():
template_dir_name
=
"openended"
def
__init__
(
self
,
system
):
self
.
system
=
system
self
.
system
=
system
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py
View file @
7a1ef62e
...
...
@@ -102,7 +102,7 @@ class OpenEndedChild(object):
if
system
.
open_ended_grading_interface
:
self
.
peer_gs
=
PeerGradingService
(
system
.
open_ended_grading_interface
,
system
)
self
.
controller_qs
=
controller_query_service
.
ControllerQueryService
(
system
.
open_ended_grading_interface
,
system
)
system
)
else
:
self
.
peer_gs
=
MockPeerGradingService
()
self
.
controller_qs
=
None
...
...
@@ -180,8 +180,8 @@ class OpenEndedChild(object):
try
:
answer
=
autolink_html
(
answer
)
cleaner
=
Cleaner
(
style
=
True
,
links
=
True
,
add_nofollow
=
False
,
page_structure
=
True
,
safe_attrs_only
=
True
,
host_whitelist
=
open_ended_image_submission
.
TRUSTED_IMAGE_DOMAINS
,
whitelist_tags
=
set
([
'embed'
,
'iframe'
,
'a'
,
'img'
]))
host_whitelist
=
open_ended_image_submission
.
TRUSTED_IMAGE_DOMAINS
,
whitelist_tags
=
set
([
'embed'
,
'iframe'
,
'a'
,
'img'
]))
clean_html
=
cleaner
.
clean_html
(
answer
)
clean_html
=
re
.
sub
(
r'</p>$'
,
''
,
re
.
sub
(
r'^<p>'
,
''
,
clean_html
))
except
:
...
...
@@ -282,7 +282,7 @@ class OpenEndedChild(object):
"""
#This is a dev_facing_error
log
.
warning
(
"Open ended child state out sync. state:
%
r, get:
%
r.
%
s"
,
self
.
child_state
,
get
,
msg
)
self
.
child_state
,
get
,
msg
)
#This is a student_facing_error
return
{
'success'
:
False
,
'error'
:
'The problem state got out-of-sync. Please try reloading the page.'
}
...
...
@@ -343,7 +343,7 @@ class OpenEndedChild(object):
try
:
image_data
.
seek
(
0
)
success
,
s3_public_url
=
open_ended_image_submission
.
upload_to_s3
(
image_data
,
image_key
,
self
.
s3_interface
)
self
.
s3_interface
)
except
:
log
.
exception
(
"Could not upload image to S3."
)
...
...
@@ -462,7 +462,7 @@ class OpenEndedChild(object):
allowed_to_submit
=
False
#This is a student_facing_error
error_message
=
error_string
.
format
(
count_required
-
count_graded
,
count_graded
,
count_required
,
student_sub_count
)
student_sub_count
)
return
success
,
allowed_to_submit
,
error_message
def
get_eta
(
self
):
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
View file @
7a1ef62e
...
...
@@ -37,7 +37,7 @@ class PeerGradingService(GradingService):
def
get_next_submission
(
self
,
problem_location
,
grader_id
):
response
=
self
.
get
(
self
.
get_next_submission_url
,
{
'location'
:
problem_location
,
'grader_id'
:
grader_id
})
{
'location'
:
problem_location
,
'grader_id'
:
grader_id
})
return
self
.
try_to_decode
(
self
.
_render_rubric
(
response
))
def
save_grade
(
self
,
location
,
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
,
rubric_scores
,
...
...
@@ -101,12 +101,12 @@ without making actual service calls to the grading controller
class
MockPeerGradingService
(
object
):
def
get_next_submission
(
self
,
problem_location
,
grader_id
):
return
{
'success'
:
True
,
'submission_id'
:
1
,
'submission_key'
:
""
,
'student_response'
:
'fake student response'
,
'prompt'
:
'fake submission prompt'
,
'rubric'
:
'fake rubric'
,
'max_score'
:
4
}
'submission_id'
:
1
,
'submission_key'
:
""
,
'student_response'
:
'fake student response'
,
'prompt'
:
'fake submission prompt'
,
'rubric'
:
'fake rubric'
,
'max_score'
:
4
}
def
save_grade
(
self
,
location
,
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
,
rubric_scores
,
submission_flagged
):
...
...
@@ -117,12 +117,12 @@ class MockPeerGradingService(object):
def
show_calibration_essay
(
self
,
problem_location
,
grader_id
):
return
{
'success'
:
True
,
'submission_id'
:
1
,
'submission_key'
:
''
,
'student_response'
:
'fake student response'
,
'prompt'
:
'fake submission prompt'
,
'rubric'
:
'fake rubric'
,
'max_score'
:
4
}
'submission_id'
:
1
,
'submission_key'
:
''
,
'student_response'
:
'fake student response'
,
'prompt'
:
'fake submission prompt'
,
'rubric'
:
'fake rubric'
,
'max_score'
:
4
}
def
save_calibration_essay
(
self
,
problem_location
,
grader_id
,
calibration_essay_id
,
submission_key
,
score
,
...
...
@@ -131,8 +131,8 @@ class MockPeerGradingService(object):
def
get_problem_list
(
self
,
course_id
,
grader_id
):
return
{
'success'
:
True
,
'problem_list'
:
[
]}
'problem_list'
:
[
]}
def
get_data_for_location
(
self
,
problem_location
,
student_id
):
return
{
"version"
:
1
,
"count_graded"
:
3
,
"count_required"
:
3
,
"success"
:
True
,
"student_sub_count"
:
1
}
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