Merge pull request #22745 from edx/andytr1/delete_manual_grade_history

Delete persistent subsection grade override history
This commit is contained in:
Andytr1
2020-01-07 13:56:01 -05:00
committed by GitHub
2 changed files with 22 additions and 57 deletions

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-01-07 16:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('grades', '0016_auto_20190703_1446'),
]
operations = [
migrations.RemoveField(
model_name='persistentsubsectiongradeoverridehistory',
name='user',
),
migrations.DeleteModel(
name='PersistentSubsectionGradeOverrideHistory',
),
]

View File

@@ -770,60 +770,3 @@ class PersistentSubsectionGradeOverride(models.Model):
getattr(subsection_grade_model, field_name)
)
return cleaned_data
@python_2_unicode_compatible
class PersistentSubsectionGradeOverrideHistory(models.Model):
"""
A django model tracking persistent grades override audit records.
.. no_pii:
"""
OVERRIDE_FEATURES = (
(constants.GradeOverrideFeatureEnum.proctoring, u'proctoring'),
(constants.GradeOverrideFeatureEnum.gradebook, u'gradebook'),
)
CREATE_OR_UPDATE = u'CREATEORUPDATE'
DELETE = u'DELETE'
OVERRIDE_ACTIONS = (
(CREATE_OR_UPDATE, u'create_or_update'),
(DELETE, u'delete')
)
class Meta(object):
app_label = "grades"
override_id = models.IntegerField(db_index=True)
feature = models.CharField(
max_length=32,
choices=OVERRIDE_FEATURES,
default=constants.GradeOverrideFeatureEnum.proctoring,
)
action = models.CharField(
max_length=32,
choices=OVERRIDE_ACTIONS,
default=CREATE_OR_UPDATE
)
user = models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE)
comments = models.CharField(max_length=300, blank=True, null=True)
created = models.DateTimeField(auto_now_add=True, db_index=True)
def __str__(self):
"""
String representation of this model.
"""
return (
u"{} override_id: {}, user_id: {}, feature: {}, action: {}, created: {}"
).format(
type(self).__name__,
self.override_id,
self.user,
self.feature,
self.action,
self.created
)
@classmethod
def get_override_history(cls, override_id):
return cls.objects.filter(override_id=override_id)