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
a1778a17
Commit
a1778a17
authored
Nov 13, 2013
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "more granular transactions in grading [LMS-1480]"
This reverts commit
19dd49f3
.
parent
371f4c9d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
56 deletions
+45
-56
lms/djangoapps/courseware/grades.py
+0
-0
lms/djangoapps/courseware/tests/test_submitting_problems.py
+16
-10
lms/djangoapps/courseware/views.py
+29
-46
No files found.
lms/djangoapps/courseware/grades.py
View file @
a1778a17
This diff is collapsed.
Click to expand it.
lms/djangoapps/courseware/tests/test_submitting_problems.py
View file @
a1778a17
...
...
@@ -236,11 +236,14 @@ class TestCourseGrader(TestSubmittingProblems):
make up the final grade. (For display)
"""
fake_request
=
self
.
factory
.
get
(
reverse
(
'progress'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
})
)
field_data_cache
=
FieldDataCache
.
cache_for_descriptor_descendents
(
self
.
course
.
id
,
self
.
student_user
,
self
.
course
)
fake_request
=
self
.
factory
.
get
(
reverse
(
'progress'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
}))
return
grades
.
grade
(
self
.
student_user
,
fake_request
,
self
.
course
)
return
grades
.
grade
(
self
.
student_user
,
fake_request
,
self
.
course
,
field_data_cache
)
def
get_progress_summary
(
self
):
"""
...
...
@@ -254,13 +257,16 @@ class TestCourseGrader(TestSubmittingProblems):
etc.
"""
fake_request
=
self
.
factory
.
get
(
reverse
(
'progress'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
})
)
field_data_cache
=
FieldDataCache
.
cache_for_descriptor_descendents
(
self
.
course
.
id
,
self
.
student_user
,
self
.
course
)
progress_summary
=
grades
.
progress_summary
(
self
.
student_user
,
fake_request
,
self
.
course
)
fake_request
=
self
.
factory
.
get
(
reverse
(
'progress'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
}))
progress_summary
=
grades
.
progress_summary
(
self
.
student_user
,
fake_request
,
self
.
course
,
field_data_cache
)
return
progress_summary
def
check_grade_percent
(
self
,
percent
):
...
...
lms/djangoapps/courseware/views.py
View file @
a1778a17
...
...
@@ -14,7 +14,6 @@ from django.shortcuts import redirect
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
django_future.csrf
import
ensure_csrf_cookie
from
django.views.decorators.cache
import
cache_control
from
django.db
import
transaction
from
markupsafe
import
escape
from
courseware
import
grades
...
...
@@ -644,9 +643,8 @@ def mktg_course_about(request, course_id):
except
(
ValueError
,
Http404
)
as
e
:
# if a course does not exist yet, display a coming
# soon button
return
render_to_response
(
'courseware/mktg_coming_soon.html'
,
{
'course_id'
:
course_id
}
)
return
render_to_response
(
'courseware/mktg_coming_soon.html'
,
{
'course_id'
:
course_id
})
registered
=
registered_for_course
(
course
,
request
.
user
)
...
...
@@ -661,36 +659,21 @@ def mktg_course_about(request, course_id):
settings
.
MITX_FEATURES
.
get
(
'ENABLE_LMS_MIGRATION'
))
course_modes
=
CourseMode
.
modes_for_course
(
course
.
id
)
return
render_to_response
(
'courseware/mktg_course_about.html'
,
{
'course'
:
course
,
'registered'
:
registered
,
'allow_registration'
:
allow_registration
,
'course_target'
:
course_target
,
'show_courseware_link'
:
show_courseware_link
,
'course_modes'
:
course_modes
,
}
)
return
render_to_response
(
'courseware/mktg_course_about.html'
,
{
'course'
:
course
,
'registered'
:
registered
,
'allow_registration'
:
allow_registration
,
'course_target'
:
course_target
,
'show_courseware_link'
:
show_courseware_link
,
'course_modes'
:
course_modes
,
})
@login_required
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
@transaction.commit_manually
def
progress
(
request
,
course_id
,
student_id
=
None
):
"""
Wraps "_progress" with the manual_transaction context manager just in case
there are unanticipated errors.
"""
with
grades
.
manual_transaction
():
return
_progress
(
request
,
course_id
,
student_id
)
def
_progress
(
request
,
course_id
,
student_id
):
"""
Unwrapped version of "progress".
User progress. We show the grade bar and every problem score.
""" User progress. We show the grade bar and every problem score.
Course staff are allowed to see the progress of students in their class.
"""
...
...
@@ -706,33 +689,33 @@ def _progress(request, course_id, student_id):
raise
Http404
student
=
User
.
objects
.
get
(
id
=
int
(
student_id
))
# NOTE: To make sure impersonation by instructor works, use
# student instead of request.user in the rest of the function.
# NOTE: To make sure impersonation by instructor works, use
# student instead of request.user in the rest of the function.
# The pre-fetching of groups is done to make auth checks not require an
# additional DB lookup (this kills the Progress page in particular).
# The pre-fetching of groups is done to make auth checks not require an
# additional DB lookup (this kills the Progress page in particular).
student
=
User
.
objects
.
prefetch_related
(
"groups"
)
.
get
(
id
=
student
.
id
)
courseware_summary
=
grades
.
progress_summary
(
student
,
request
,
course
)
field_data_cache
=
FieldDataCache
.
cache_for_descriptor_descendents
(
course_id
,
student
,
course
,
depth
=
None
)
grade_summary
=
grades
.
grade
(
student
,
request
,
course
)
courseware_summary
=
grades
.
progress_summary
(
student
,
request
,
course
,
field_data_cache
)
grade_summary
=
grades
.
grade
(
student
,
request
,
course
,
field_data_cache
)
if
courseware_summary
is
None
:
#This means the student didn't have access to the course (which the instructor requested)
raise
Http404
context
=
{
'course'
:
course
,
'courseware_summary'
:
courseware_summary
,
'grade_summary'
:
grade_summary
,
'staff_access'
:
staff_access
,
'student'
:
student
,
}
with
grades
.
manual_transaction
():
response
=
render_to_response
(
'courseware/progress.html'
,
context
)
context
=
{
'course'
:
course
,
'courseware_summary'
:
courseware_summary
,
'grade_summary'
:
grade_summary
,
'staff_access'
:
staff_access
,
'student'
:
student
,
}
context
.
update
()
return
re
sponse
return
re
nder_to_response
(
'courseware/progress.html'
,
context
)
@login_required
...
...
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