Adding simple history to track grade changes. Educator-4347

added migration

Adding simple history to track grade changes. Educator-4347
Adding migration file

Adding simple history to track grade changes. Educator-4347
Adding migration file

Adding simple history to track grade changes. Educator-4347
Adding migration file

Re-adding lms.djangoapps reference to see if it will fix the build issues

Re-adding lms.djangoapps reference to see if it will fix the build issues
This commit is contained in:
atesker
2019-06-06 09:45:45 -04:00
parent 2186b1a40b
commit a914faf11c
3 changed files with 50 additions and 1 deletions

View File

@@ -1127,6 +1127,8 @@ INSTALLED_APPS = [
'survey.apps.SurveyConfig',
'lms.djangoapps.verify_student.apps.VerifyStudentConfig',
'completion',
# Reference we couldn't get simple_history dependencies working in any other way. Leaving it
'lms.djangoapps.grades.apps.GradesConfig',
# Microsite configuration application
'microsite_configuration',
@@ -1178,6 +1180,7 @@ INSTALLED_APPS = [
'openedx.features.course_duration_limits',
'openedx.features.content_type_gating',
'experiments',
]

View File

@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-05 13:59
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('grades', '0014_persistentsubsectiongradeoverridehistory'),
]
operations = [
migrations.CreateModel(
name='HistoricalPersistentSubsectionGradeOverride',
fields=[
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
('created', models.DateTimeField(blank=True, db_index=True, editable=False)),
('modified', models.DateTimeField(blank=True, db_index=True, editable=False)),
('earned_all_override', models.FloatField(blank=True, null=True)),
('possible_all_override', models.FloatField(blank=True, null=True)),
('earned_graded_override', models.FloatField(blank=True, null=True)),
('possible_graded_override', models.FloatField(blank=True, null=True)),
('history_id', models.AutoField(primary_key=True, serialize=False)),
('history_date', models.DateTimeField()),
('history_change_reason', models.CharField(max_length=100, null=True)),
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
('grade', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='grades.PersistentSubsectionGrade')),
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ('-history_date', '-history_id'),
'get_latest_by': 'history_date',
'verbose_name': 'historical persistent subsection grade override',
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
]

View File

@@ -25,7 +25,8 @@ from opaque_keys.edx.keys import CourseKey, UsageKey
from coursewarehistoryextended.fields import UnsignedBigIntAutoField, UnsignedBigIntOneToOneField
from lms.djangoapps.grades import events, constants
from openedx.core.lib.cache_utils import get_cache
from simple_history.models import HistoricalRecords
from simple_history.utils import update_change_reason
log = logging.getLogger(__name__)
@@ -652,6 +653,7 @@ class PersistentSubsectionGradeOverride(models.Model):
possible_graded_override = models.FloatField(null=True, blank=True)
_CACHE_NAMESPACE = u"grades.models.PersistentSubsectionGradeOverride"
history = HistoricalRecords()
def __unicode__(self):
return u', '.join([
@@ -703,6 +705,7 @@ class PersistentSubsectionGradeOverride(models.Model):
grade=subsection_grade_model,
defaults=cls._prepare_override_params(subsection_grade_model, override_data),
)
update_change_reason(override, feature)
action = action or PersistentSubsectionGradeOverrideHistory.CREATE_OR_UPDATE