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
45c54ee6
Unverified
Commit
45c54ee6
authored
4 years ago
by
Jansen Kantor
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
log grade policy changes (#25247)
* log grade policy changes * quality
parent
fb626cd0
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/djangoapps/contentstore/signals/handlers.py
+2
-0
2 additions, 0 deletions
cms/djangoapps/contentstore/signals/handlers.py
cms/djangoapps/models/settings/course_grading.py
+22
-25
22 additions, 25 deletions
cms/djangoapps/models/settings/course_grading.py
with
24 additions
and
25 deletions
cms/djangoapps/contentstore/signals/handlers.py
+
2
−
0
View file @
45c54ee6
...
...
@@ -34,6 +34,8 @@ def locked(expiry_seconds, key):
if
cache
.
add
(
cache_key
,
"
true
"
,
expiry_seconds
):
log
.
info
(
u
'
Locking task in cache with key: %s for %s seconds
'
,
cache_key
,
expiry_seconds
)
return
func
(
*
args
,
**
kwargs
)
else
:
log
.
info
(
'
Task with key %s already exists in cache
'
,
cache_key
)
return
wrapper
return
task_decorator
...
...
This diff is collapsed.
Click to expand it.
cms/djangoapps/models/settings/course_grading.py
+
22
−
25
View file @
45c54ee6
...
...
@@ -2,6 +2,7 @@
import
json
import
logging
from
base64
import
b64encode
from
datetime
import
timedelta
from
hashlib
import
sha1
...
...
@@ -14,6 +15,8 @@ from track.event_transaction_utils import create_new_event_transaction_id
from
xmodule.modulestore.django
import
modulestore
from
models.settings.waffle
import
material_recompute_only
log
=
logging
.
getLogger
(
__name__
)
GRADING_POLICY_CHANGED_EVENT_TYPE
=
'
edx.grades.grading_policy_changed
'
...
...
@@ -68,6 +71,7 @@ class CourseGradingModel(object):
Probably not the usual path for updates as it
'
s too coarse grained.
"""
descriptor
=
modulestore
().
get_course
(
course_key
)
previous_grading_policy_hash
=
six
.
text_type
(
hash_grading_policy
(
descriptor
.
grading_policy
))
graders_parsed
=
[
CourseGradingModel
.
parse_grader
(
jsonele
)
for
jsonele
in
jsondict
[
'
graders
'
]]
fire_signal
=
CourseGradingModel
.
must_fire_grading_event_and_signal
(
...
...
@@ -84,35 +88,17 @@ class CourseGradingModel(object):
CourseGradingModel
.
update_grace_period_from_json
(
course_key
,
jsondict
[
'
grace_period
'
],
user
)
CourseGradingModel
.
update_minimum_grade_credit_from_json
(
course_key
,
jsondict
[
'
minimum_grade_credit
'
],
user
)
if
fire_signal
:
_grading_event_and_signal
(
course_key
,
user
.
id
)
return
CourseGradingModel
.
fetch
(
course_key
)
@staticmethod
def
update_from_json_selective
(
course_key
,
jsondict
,
user
):
"""
New version that doesn
'
t fire change events when only name or short name are changed.
Decode the json into CourseGradingModel and save any changes. Returns the modified model.
Probably not the usual path for updates as it
'
s too coarse grained.
"""
descriptor
=
modulestore
().
get_course
(
course_key
)
graders_parsed
=
[
CourseGradingModel
.
parse_grader
(
jsonele
)
for
jsonele
in
jsondict
[
'
graders
'
]]
fire_signal
=
C
ourse
G
rading
Model
.
must_fire_grading_event_and_signal
(
course_key
,
graders_parsed
,
descriptor
,
jsondict
new_grading_policy_hash
=
six
.
text_type
(
hash_grading_policy
(
descriptor
.
grading_policy
))
log
.
info
(
"
Updated c
ourse
g
rading
policy for course %s from %s to %s. fire_signal = %s
"
,
six
.
text_type
(
course_key
)
,
previous_grading_policy_hash
,
new_grading_policy_hash
,
fire_signal
)
descriptor
.
raw_grader
=
graders_parsed
descriptor
.
grade_cutoffs
=
jsondict
[
'
grade_cutoffs
'
]
modulestore
().
update_item
(
descriptor
,
user
.
id
)
CourseGradingModel
.
update_grace_period_from_json
(
course_key
,
jsondict
[
'
grace_period
'
],
user
)
CourseGradingModel
.
update_minimum_grade_credit_from_json
(
course_key
,
jsondict
[
'
minimum_grade_credit
'
],
user
)
if
fire_signal
:
_grading_event_and_signal
(
course_key
,
user
.
id
)
...
...
@@ -169,6 +155,7 @@ class CourseGradingModel(object):
grader which is a full model on the client but not on the server (just a dict)
"""
descriptor
=
modulestore
().
get_course
(
course_key
)
previous_grading_policy_hash
=
six
.
text_type
(
hash_grading_policy
(
descriptor
.
grading_policy
))
# parse removes the id; so, grab it before parse
index
=
int
(
grader
.
get
(
'
id
'
,
len
(
descriptor
.
raw_grader
)))
...
...
@@ -186,6 +173,16 @@ class CourseGradingModel(object):
descriptor
.
raw_grader
.
append
(
grader
)
modulestore
().
update_item
(
descriptor
,
user
.
id
)
descriptor
=
modulestore
().
get_course
(
course_key
)
new_grading_policy_hash
=
six
.
text_type
(
hash_grading_policy
(
descriptor
.
grading_policy
))
log
.
info
(
"
Updated grader for course %s. Grading policy has changed from %s to %s. fire_signal = %s
"
,
six
.
text_type
(
course_key
),
previous_grading_policy_hash
,
new_grading_policy_hash
,
fire_signal
)
if
fire_signal
:
_grading_event_and_signal
(
course_key
,
user
.
id
)
...
...
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