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
ef6d77b1
Commit
ef6d77b1
authored
Jan 10, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up names and refactor out some common logic
parent
084a3c33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
lms/djangoapps/open_ended_grading/views.py
+22
-15
No files found.
lms/djangoapps/open_ended_grading/views.py
View file @
ef6d77b1
...
...
@@ -26,6 +26,18 @@ if settings.MOCK_PEER_GRADING:
else
:
peer_gs
=
PeerGradingService
(
settings
.
PEER_GRADING_INTERFACE
)
"""
Reverses the URL from the name and the course id, and then adds a trailing slash if
it does not exist yet
"""
def
_reverse_with_slash
(
url_name
,
course_id
):
ajax_url
=
reverse
(
url_name
,
kwargs
=
{
'course_id'
:
course_id
})
if
not
ajax_url
.
endswith
(
'/'
):
ajax_url
+=
'/'
return
ajax_url
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
staff_grading
(
request
,
course_id
):
"""
...
...
@@ -33,9 +45,7 @@ def staff_grading(request, course_id):
"""
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'staff'
)
ajax_url
=
reverse
(
'staff_grading'
,
kwargs
=
{
'course_id'
:
course_id
})
if
not
ajax_url
.
endswith
(
'/'
):
ajax_url
+=
'/'
ajax_url
=
_reverse_with_slash
(
'staff_grading'
,
course_id
)
return
render_to_response
(
'instructor/staff_grading.html'
,
{
'course'
:
course
,
...
...
@@ -57,24 +67,23 @@ def peer_grading(request, course_id):
error_text
=
""
problem_list
=
[]
try
:
problem_list_
text
=
peer_gs
.
get_problem_list
(
course_id
,
unique_id_for_user
(
request
.
user
))
problem_list_
json
=
json
.
loads
(
problem_list_text
)
success
=
problem_list_
json
[
'success'
]
if
'error'
in
problem_list_
json
:
error_text
=
problem_list_
json
[
'error'
]
problem_list_
json
=
peer_gs
.
get_problem_list
(
course_id
,
unique_id_for_user
(
request
.
user
))
problem_list_
dict
=
json
.
loads
(
problem_list_json
)
success
=
problem_list_
dict
[
'success'
]
if
'error'
in
problem_list_
dict
:
error_text
=
problem_list_
dict
[
'error'
]
problem_list
=
problem_list_
json
[
'problem_list'
]
problem_list
=
problem_list_
dict
[
'problem_list'
]
except
GradingServiceError
:
error_text
=
"Error occured while contacting the grading service"
success
=
False
# catch error if if the json loads fails
except
ValueError
:
error_text
=
"Could not get problem list"
success
=
False
ajax_url
=
reverse
(
'peer_grading'
,
kwargs
=
{
'course_id'
:
course_id
})
if
not
ajax_url
.
endswith
(
'/'
):
ajax_url
+=
'/'
ajax_url
=
_reverse_with_slash
(
'peer_grading'
,
course_id
)
return
render_to_response
(
'peer_grading/peer_grading.html'
,
{
'course'
:
course
,
...
...
@@ -95,9 +104,7 @@ def peer_grading_problem(request, course_id):
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
problem_location
=
request
.
GET
.
get
(
"location"
)
ajax_url
=
reverse
(
'peer_grading'
,
kwargs
=
{
'course_id'
:
course_id
})
if
not
ajax_url
.
endswith
(
'/'
):
ajax_url
+=
'/'
ajax_url
=
_reverse_with_slash
(
'peer_grading'
,
course_id
)
return
render_to_response
(
'peer_grading/peer_grading_problem.html'
,
{
'view_html'
:
''
,
...
...
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