Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
b7d53e26
Unverified
Commit
b7d53e26
authored
6 years ago
by
Zachary Hancock
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #19490 from edx/zhancock/monitor-bulk-update
Add logging to gradebook bulk update
parents
c515b357
a93fe4d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cms/static/js/certificates/factories/certificates_page_factory.js
+7
-7
7 additions, 7 deletions
...ic/js/certificates/factories/certificates_page_factory.js
lms/djangoapps/grades/api/v1/gradebook_views.py
+30
-1
30 additions, 1 deletion
lms/djangoapps/grades/api/v1/gradebook_views.py
with
37 additions
and
8 deletions
cms/static/js/certificates/factories/certificates_page_factory.js
+
7
−
7
View file @
b7d53e26
...
...
@@ -20,8 +20,8 @@ define([
],
function
(
$
,
CertificatesCollection
,
Certificate
,
CertificatesPage
,
CertificatePreview
)
{
'
use strict
'
;
return
function
(
certificatesJson
,
certificateUrl
,
courseOutlineUrl
,
course
_m
odes
,
certificate
_web_v
iew
_u
rl
,
is
_a
ctive
,
certificate
_a
ctivation
_h
andler
_u
rl
)
{
return
function
(
certificatesJson
,
certificateUrl
,
courseOutlineUrl
,
course
M
odes
,
certificate
WebV
iew
U
rl
,
is
A
ctive
,
certificate
A
ctivation
H
andler
U
rl
)
{
// Initialize the model collection, passing any necessary options to the constructor
var
certificatesCollection
=
new
CertificatesCollection
(
certificatesJson
,
{
parse
:
true
,
...
...
@@ -31,12 +31,12 @@ function($, CertificatesCollection, Certificate, CertificatesPage, CertificatePr
// associating the certificate_preview globally.
// need to show / hide this view in some other places.
if
(
!
window
.
certWebPreview
&&
certificate
_web_v
iew
_u
rl
)
{
if
(
!
window
.
certWebPreview
&&
certificate
WebV
iew
U
rl
)
{
window
.
certWebPreview
=
new
CertificatePreview
({
course_modes
:
course
_m
odes
,
certificate_web_view_url
:
certificate
_web_v
iew
_u
rl
,
certificate_activation_handler_url
:
certificate
_a
ctivation
_h
andler
_u
rl
,
is_active
:
is
_a
ctive
course_modes
:
course
M
odes
,
certificate_web_view_url
:
certificate
WebV
iew
U
rl
,
certificate_activation_handler_url
:
certificate
A
ctivation
H
andler
U
rl
,
is_active
:
is
A
ctive
});
}
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/grades/api/v1/gradebook_views.py
+
30
−
1
View file @
b7d53e26
"""
Defines an endpoint for gradebook data related to a course.
"""
import
logging
from
collections
import
namedtuple
from
contextlib
import
contextmanager
from
functools
import
wraps
...
...
@@ -53,6 +54,8 @@ from track.event_transaction_utils import (
from
xmodule.modulestore.django
import
modulestore
from
xmodule.util.misc
import
get_default_short_labeler
log
=
logging
.
getLogger
(
__name__
)
@contextmanager
def
bulk_gradebook_view_context
(
course_key
,
users
):
...
...
@@ -666,6 +669,7 @@ class GradebookBulkUpdateView(GradeViewMixin, PaginatedAPIView):
user
=
self
.
_get_single_user
(
request
,
course_key
,
requested_user_id
)
usage_key
=
UsageKey
.
from_string
(
requested_usage_id
)
except
(
USER_MODEL
.
DoesNotExist
,
InvalidKeyError
,
CourseEnrollment
.
DoesNotExist
)
as
exc
:
self
.
_log_update_result
(
request
.
user
,
requested_user_id
,
requested_usage_id
,
success
=
False
)
result
.
append
(
GradebookUpdateResponseItem
(
user_id
=
requested_user_id
,
usage_id
=
requested_usage_id
,
...
...
@@ -685,6 +689,7 @@ class GradebookBulkUpdateView(GradeViewMixin, PaginatedAPIView):
if
subsection
:
subsection_grade_model
=
self
.
_create_subsection_grade
(
user
,
course
,
subsection
)
else
:
self
.
_log_update_result
(
request
.
user
,
requested_user_id
,
requested_usage_id
,
success
=
False
)
result
.
append
(
GradebookUpdateResponseItem
(
user_id
=
requested_user_id
,
usage_id
=
requested_usage_id
,
...
...
@@ -694,7 +699,11 @@ class GradebookBulkUpdateView(GradeViewMixin, PaginatedAPIView):
continue
if
subsection_grade_model
:
self
.
_create_override
(
request
.
user
,
subsection_grade_model
,
**
user_data
[
'
grade
'
])
override
=
self
.
_create_override
(
request
.
user
,
subsection_grade_model
,
**
user_data
[
'
grade
'
])
self
.
_log_update_result
(
request
.
user
,
requested_user_id
,
requested_usage_id
,
subsection_grade_model
,
override
,
True
)
result
.
append
(
GradebookUpdateResponseItem
(
user_id
=
user
.
id
,
usage_id
=
text_type
(
usage_key
),
...
...
@@ -754,6 +763,7 @@ class GradebookBulkUpdateView(GradeViewMixin, PaginatedAPIView):
)
# Emit events to let our tracking system to know we updated subsection grade
subsection_grade_calculated
(
subsection_grade_model
)
return
override
def
_clean_override_data
(
self
,
override_data
):
"""
...
...
@@ -771,3 +781,22 @@ class GradebookBulkUpdateView(GradeViewMixin, PaginatedAPIView):
if
field
in
allowed_fields
:
stripped_data
[
field
]
=
override_data
[
field
]
return
stripped_data
@staticmethod
def
_log_update_result
(
request_user
,
user_id
,
usage_id
,
subsection_grade_model
=
None
,
subsection_grade_override
=
None
,
success
=
False
):
log
.
info
(
'
Grades: Bulk_Update, UpdatedByUser: %s, User: %s, Usage: %s, Grade: %s, GradeOverride: %s, Success: %s
'
,
request_user
.
id
,
user_id
,
usage_id
,
subsection_grade_model
,
subsection_grade_override
,
success
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment