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
741cdf95
Commit
741cdf95
authored
May 12, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3688 from edx/dhm/opaque-keys-bugs
Dhm/opaque keys bugs
parents
45e89849
bf8ca487
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
30 deletions
+26
-30
common/lib/xmodule/xmodule/open_ended_grading_classes/controller_query_service.py
+1
-1
lms/djangoapps/open_ended_grading/staff_grading_service.py
+6
-7
lms/djangoapps/open_ended_grading/tests.py
+11
-11
lms/djangoapps/open_ended_grading/views.py
+8
-11
No files found.
common/lib/xmodule/xmodule/open_ended_grading_classes/controller_query_service.py
View file @
741cdf95
...
...
@@ -37,7 +37,7 @@ class ControllerQueryService(GradingService):
def
check_combined_notifications
(
self
,
course_id
,
student_id
,
user_is_staff
,
last_time_viewed
):
params
=
{
'student_id'
:
student_id
,
'course_id'
:
course_id
,
'course_id'
:
course_id
.
to_deprecated_string
()
,
'user_is_staff'
:
user_is_staff
,
'last_time_viewed'
:
last_time_viewed
,
}
...
...
lms/djangoapps/open_ended_grading/staff_grading_service.py
View file @
741cdf95
...
...
@@ -9,7 +9,6 @@ from django.conf import settings
from
django.http
import
HttpResponse
,
Http404
from
django.utils.translation
import
ugettext
as
_
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.open_ended_grading_classes.grading_service_module
import
GradingService
,
GradingServiceError
from
xmodule.modulestore.django
import
ModuleI18nService
...
...
@@ -116,7 +115,7 @@ class StaffGradingService(GradingService):
Raises:
GradingServiceError: something went wrong with the connection.
"""
params
=
{
'course_id'
:
course_id
,
'grader_id'
:
grader_id
}
params
=
{
'course_id'
:
course_id
.
to_deprecated_string
()
,
'grader_id'
:
grader_id
}
result
=
self
.
get
(
self
.
get_problem_list_url
,
params
)
tags
=
[
u'course_id:{}'
.
format
(
course_id
)]
self
.
_record_result
(
'get_problem_list'
,
result
,
tags
)
...
...
@@ -148,7 +147,7 @@ class StaffGradingService(GradingService):
self
.
get
(
self
.
get_next_url
,
params
=
{
'location'
:
location
,
'location'
:
location
.
to_deprecated_string
()
,
'grader_id'
:
grader_id
}
)
...
...
@@ -170,7 +169,7 @@ class StaffGradingService(GradingService):
Raises:
GradingServiceError if there's a problem connecting.
"""
data
=
{
'course_id'
:
course_id
,
data
=
{
'course_id'
:
course_id
.
to_deprecated_string
()
,
'submission_id'
:
submission_id
,
'score'
:
score
,
'feedback'
:
feedback
,
...
...
@@ -186,7 +185,7 @@ class StaffGradingService(GradingService):
return
result
def
get_notifications
(
self
,
course_id
):
params
=
{
'course_id'
:
course_id
}
params
=
{
'course_id'
:
course_id
.
to_deprecated_string
()
}
result
=
self
.
get
(
self
.
get_notifications_url
,
params
)
tags
=
[
u'course_id:{}'
.
format
(
course_id
),
...
...
@@ -274,7 +273,7 @@ def get_next(request, course_id):
', '
.
join
(
missing
)))
grader_id
=
unique_id_for_user
(
request
.
user
)
p
=
request
.
POST
location
=
p
[
'location'
]
location
=
course_key
.
make_usage_key_from_deprecated_string
(
p
[
'location'
])
return
HttpResponse
(
json
.
dumps
(
_get_next
(
course_key
,
grader_id
,
location
)),
mimetype
=
"application/json"
)
...
...
@@ -400,7 +399,7 @@ def save_grade(request, course_id):
grader_id
=
unique_id_for_user
(
request
.
user
)
location
=
p
[
'location'
]
location
=
course_key
.
make_usage_key_from_deprecated_string
(
p
[
'location'
])
try
:
result
=
staff_grading_service
()
.
save_grade
(
course_key
,
...
...
lms/djangoapps/open_ended_grading/tests.py
View file @
741cdf95
...
...
@@ -109,13 +109,13 @@ class TestStaffGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
student
=
'view@test.com'
self
.
instructor
=
'view2@test.com'
self
.
password
=
'foo'
self
.
location
=
'TestLocation'
self
.
create_account
(
'u1'
,
self
.
student
,
self
.
password
)
self
.
create_account
(
'u2'
,
self
.
instructor
,
self
.
password
)
self
.
activate_user
(
self
.
student
)
self
.
activate_user
(
self
.
instructor
)
self
.
course_id
=
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
self
.
location_string
=
self
.
course_id
.
make_usage_key
(
'html'
,
'TestLocation'
)
.
to_deprecated_string
()
self
.
toy
=
modulestore
()
.
get_course
(
self
.
course_id
)
make_instructor
(
self
.
toy
,
self
.
instructor
)
...
...
@@ -140,7 +140,7 @@ class TestStaffGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
login
(
self
.
instructor
,
self
.
password
)
url
=
reverse
(
'staff_grading_get_next'
,
kwargs
=
{
'course_id'
:
self
.
course_id
.
to_deprecated_string
()})
data
=
{
'location'
:
self
.
location
}
data
=
{
'location'
:
self
.
location
_string
}
response
=
check_for_post_code
(
self
,
200
,
url
,
data
)
...
...
@@ -165,7 +165,7 @@ class TestStaffGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
data
=
{
'score'
:
'12'
,
'feedback'
:
'great!'
,
'submission_id'
:
'123'
,
'location'
:
self
.
location
,
'location'
:
self
.
location
_string
,
'submission_flagged'
:
"true"
,
'rubric_scores[]'
:
[
'1'
,
'2'
]}
if
skip
:
...
...
@@ -227,7 +227,7 @@ class TestStaffGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
'score'
:
'12'
,
'feedback'
:
''
,
'submission_id'
:
'123'
,
'location'
:
self
.
location
,
'location'
:
self
.
location
_string
,
'submission_flagged'
:
"false"
,
'rubric_scores[]'
:
[
'1'
,
'2'
]
}
...
...
@@ -262,13 +262,13 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
student
=
'view@test.com'
self
.
instructor
=
'view2@test.com'
self
.
password
=
'foo'
self
.
location
=
'TestLocation'
self
.
create_account
(
'u1'
,
self
.
student
,
self
.
password
)
self
.
create_account
(
'u2'
,
self
.
instructor
,
self
.
password
)
self
.
activate_user
(
self
.
student
)
self
.
activate_user
(
self
.
instructor
)
self
.
course_id
=
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
self
.
location_string
=
self
.
course_id
.
make_usage_key
(
'html'
,
'TestLocation'
)
.
to_deprecated_string
()
self
.
toy
=
modulestore
()
.
get_course
(
self
.
course_id
)
location
=
"i4x://edX/toy/peergrading/init"
field_data
=
DictFieldData
({
'data'
:
"<peergrading/>"
,
'location'
:
location
,
'category'
:
'peergrading'
})
...
...
@@ -292,7 +292,7 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
logout
()
def
test_get_next_submission_success
(
self
):
data
=
{
'location'
:
self
.
location
}
data
=
{
'location'
:
self
.
location
_string
}
response
=
self
.
peer_module
.
get_next_submission
(
data
)
content
=
response
...
...
@@ -312,7 +312,7 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_save_grade_success
(
self
):
data
=
{
'rubric_scores[]'
:
[
0
,
0
],
'location'
:
self
.
location
,
'location'
:
self
.
location
_string
,
'submission_id'
:
1
,
'submission_key'
:
'fake key'
,
'score'
:
2
,
...
...
@@ -342,7 +342,7 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
assertTrue
(
d
[
'error'
]
.
find
(
'Missing required keys:'
)
>
-
1
)
def
test_is_calibrated_success
(
self
):
data
=
{
'location'
:
self
.
location
}
data
=
{
'location'
:
self
.
location
_string
}
response
=
self
.
peer_module
.
is_student_calibrated
(
data
)
self
.
assertTrue
(
response
[
'success'
])
...
...
@@ -355,7 +355,7 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
assertFalse
(
'calibrated'
in
response
)
def
test_show_calibration_essay_success
(
self
):
data
=
{
'location'
:
self
.
location
}
data
=
{
'location'
:
self
.
location
_string
}
response
=
self
.
peer_module
.
show_calibration_essay
(
data
)
...
...
@@ -376,7 +376,7 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_save_calibration_essay_success
(
self
):
data
=
{
'rubric_scores[]'
:
[
0
,
0
],
'location'
:
self
.
location
,
'location'
:
self
.
location
_string
,
'submission_id'
:
1
,
'submission_key'
:
'fake key'
,
'score'
:
2
,
...
...
@@ -410,7 +410,7 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
data
=
{
'rubric_scores[]'
:
[
0
,
0
],
'location'
:
self
.
location
,
'location'
:
self
.
location
_string
,
'submission_id'
:
1
,
'submission_key'
:
'fake key'
,
'score'
:
2
,
...
...
lms/djangoapps/open_ended_grading/views.py
View file @
741cdf95
import
logging
from
django.conf
import
settings
from
django.views.decorators.cache
import
cache_control
from
edxmako.shortcuts
import
render_to_response
from
django.core.urlresolvers
import
reverse
from
student.models
import
unique_id_for_user
from
courseware.courses
import
get_course_with_access
from
xmodule.open_ended_grading_classes.grading_service_module
import
GradingServiceError
...
...
@@ -20,11 +18,11 @@ from xmodule.modulestore import SlashSeparatedCourseKey
from
xmodule.modulestore.exceptions
import
NoPathToItem
from
django.http
import
HttpResponse
,
Http404
,
HttpResponseRedirect
from
edxmako.shortcuts
import
render_to_string
from
django.utils.translation
import
ugettext
as
_
from
open_ended_grading.utils
import
(
STAFF_ERROR_MESSAGE
,
STUDENT_ERROR_MESSAGE
,
StudentProblemList
,
generate_problem_url
,
create_controller_query_service
)
from
open_ended_grading.utils
import
(
STAFF_ERROR_MESSAGE
,
StudentProblemList
,
generate_problem_url
,
create_controller_query_service
)
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -68,9 +66,10 @@ def staff_grading(request, course_id):
"""
Show the instructor grading interface.
"""
course
=
get_course_with_access
(
request
.
user
,
'staff'
,
course_id
)
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
course
=
get_course_with_access
(
request
.
user
,
'staff'
,
course_key
)
ajax_url
=
_reverse_with_slash
(
'staff_grading'
,
course_
id
)
ajax_url
=
_reverse_with_slash
(
'staff_grading'
,
course_
key
)
return
render_to_response
(
'instructor/staff_grading.html'
,
{
'course'
:
course
,
...
...
@@ -118,9 +117,9 @@ def peer_grading(request, course_id):
When a student clicks on the "peer grading" button in the open ended interface, link them to a peer grading
xmodule in the course.
'''
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
#Get the current course
course
=
get_course_with_access
(
request
.
user
,
'load'
,
course_
id
)
course
=
get_course_with_access
(
request
.
user
,
'load'
,
course_
key
)
found_module
,
problem_url
=
find_peer_grading_module
(
course
)
if
not
found_module
:
...
...
@@ -187,13 +186,11 @@ def flagged_problem_list(request, course_id):
'''
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
course
=
get_course_with_access
(
request
.
user
,
'staff'
,
course_key
)
student_id
=
unique_id_for_user
(
request
.
user
)
# call problem list service
success
=
False
error_text
=
""
problem_list
=
[]
base_course_url
=
reverse
(
'courses'
)
# Make a service that can query edX ORA.
controller_qs
=
create_controller_query_service
()
...
...
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