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
cd49e1bb
Commit
cd49e1bb
authored
Jun 13, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check to see if a location is valid before displaying it for instructor grading
parent
c2e5c607
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
lms/djangoapps/open_ended_grading/staff_grading_service.py
+10
-1
lms/djangoapps/open_ended_grading/utils.py
+16
-0
lms/djangoapps/open_ended_grading/views.py
+1
-1
No files found.
lms/djangoapps/open_ended_grading/staff_grading_service.py
View file @
cd49e1bb
...
@@ -15,6 +15,7 @@ from xmodule.course_module import CourseDescriptor
...
@@ -15,6 +15,7 @@ from xmodule.course_module import CourseDescriptor
from
student.models
import
unique_id_for_user
from
student.models
import
unique_id_for_user
from
xmodule.x_module
import
ModuleSystem
from
xmodule.x_module
import
ModuleSystem
from
mitxmako.shortcuts
import
render_to_string
from
mitxmako.shortcuts
import
render_to_string
from
utils
import
does_location_exist
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -240,7 +241,6 @@ def get_next(request, course_id):
...
@@ -240,7 +241,6 @@ def get_next(request, course_id):
return
HttpResponse
(
_get_next
(
course_id
,
grader_id
,
location
),
return
HttpResponse
(
_get_next
(
course_id
,
grader_id
,
location
),
mimetype
=
"application/json"
)
mimetype
=
"application/json"
)
def
get_problem_list
(
request
,
course_id
):
def
get_problem_list
(
request
,
course_id
):
"""
"""
Get all the problems for the given course id
Get all the problems for the given course id
...
@@ -266,6 +266,15 @@ def get_problem_list(request, course_id):
...
@@ -266,6 +266,15 @@ def get_problem_list(request, course_id):
_check_access
(
request
.
user
,
course_id
)
_check_access
(
request
.
user
,
course_id
)
try
:
try
:
response
=
staff_grading_service
()
.
get_problem_list
(
course_id
,
unique_id_for_user
(
request
.
user
))
response
=
staff_grading_service
()
.
get_problem_list
(
course_id
,
unique_id_for_user
(
request
.
user
))
response
=
json
.
loads
(
response
)
problem_list
=
response
[
'problem_list'
]
valid_problem_list
=
[]
for
i
in
xrange
(
0
,
len
(
problem_list
)):
if
does_location_exist
(
course_id
,
problem_list
[
i
][
'location'
]):
valid_problem_list
.
append
(
problem_list
[
i
])
response
[
'problem_list'
]
=
valid_problem_list
response
=
json
.
dumps
(
response
)
return
HttpResponse
(
response
,
return
HttpResponse
(
response
,
mimetype
=
"application/json"
)
mimetype
=
"application/json"
)
except
GradingServiceError
:
except
GradingServiceError
:
...
...
lms/djangoapps/open_ended_grading/utils.py
0 → 100644
View file @
cd49e1bb
from
xmodule.modulestore
import
search
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
def
does_location_exist
(
course_id
,
location
):
"""
Checks to see if a valid module exists at a given location (ie has not been deleted)
course_id - string course id
location - string location
"""
try
:
search
.
path_to_location
(
modulestore
(),
course_id
,
location
)
return
True
except
ItemNotFoundError
:
#If the problem cannot be found at the location received from the grading controller server, it has been deleted by the course author.
return
False
lms/djangoapps/open_ended_grading/views.py
View file @
cd49e1bb
...
@@ -179,6 +179,7 @@ def student_problem_list(request, course_id):
...
@@ -179,6 +179,7 @@ def student_problem_list(request, course_id):
error_text
=
""
error_text
=
""
problem_list
=
[]
problem_list
=
[]
base_course_url
=
reverse
(
'courses'
)
base_course_url
=
reverse
(
'courses'
)
list_to_remove
=
[]
try
:
try
:
#Get list of all open ended problems that the grading server knows about
#Get list of all open ended problems that the grading server knows about
...
@@ -192,7 +193,6 @@ def student_problem_list(request, course_id):
...
@@ -192,7 +193,6 @@ def student_problem_list(request, course_id):
problem_list
=
problem_list_dict
[
'problem_list'
]
problem_list
=
problem_list_dict
[
'problem_list'
]
#A list of problems to remove (problems that can't be found in the course)
#A list of problems to remove (problems that can't be found in the course)
list_to_remove
=
[]
for
i
in
xrange
(
0
,
len
(
problem_list
)):
for
i
in
xrange
(
0
,
len
(
problem_list
)):
try
:
try
:
#Try to load each problem in the courseware to get links to them
#Try to load each problem in the courseware to get links to them
...
...
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