Commit c6b21d13 by Adam

Merge pull request #11293 from edx/release

Release
parents d8af9524 ccc96cde
...@@ -592,18 +592,6 @@ class CourseMode(models.Model): ...@@ -592,18 +592,6 @@ class CourseMode(models.Model):
modes = cls.modes_for_course(course_id) modes = cls.modes_for_course(course_id)
return min(mode.min_price for mode in modes if mode.currency.lower() == currency.lower()) return min(mode.min_price for mode in modes if mode.currency.lower() == currency.lower())
@classmethod
def is_eligible_for_certificate(cls, mode_slug):
"""
Returns whether or not the given mode_slug is eligible for a
certificate. Currently all modes other than 'audit' grant a
certificate. Note that audit enrollments which existed prior
to December 2015 *were* given certificates, so there will be
GeneratedCertificate records with mode='audit' and
eligible_for_certificate=True.
"""
return mode_slug != cls.AUDIT
def to_tuple(self): def to_tuple(self):
""" """
Takes a mode model and turns it into a model named tuple. Takes a mode model and turns it into a model named tuple.
......
...@@ -430,16 +430,3 @@ class CourseModeModelTest(TestCase): ...@@ -430,16 +430,3 @@ class CourseModeModelTest(TestCase):
verified_mode.expiration_datetime = None verified_mode.expiration_datetime = None
self.assertFalse(verified_mode.expiration_datetime_is_explicit) self.assertFalse(verified_mode.expiration_datetime_is_explicit)
self.assertIsNone(verified_mode.expiration_datetime) self.assertIsNone(verified_mode.expiration_datetime)
@ddt.data(
(CourseMode.AUDIT, False),
(CourseMode.HONOR, True),
(CourseMode.VERIFIED, True),
(CourseMode.CREDIT_MODE, True),
(CourseMode.PROFESSIONAL, True),
(CourseMode.NO_ID_PROFESSIONAL_MODE, True),
)
@ddt.unpack
def test_eligible_for_cert(self, mode_slug, expected_eligibility):
"""Verify that non-audit modes are eligible for a cert."""
self.assertEqual(CourseMode.is_eligible_for_certificate(mode_slug), expected_eligibility)
""" Command line script to change user enrollments. """
import logging
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from opaque_keys import InvalidKeyError from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from optparse import make_option from optparse import make_option
from student.models import CourseEnrollment, User from student.models import CourseEnrollment, User
from opaque_keys.edx.keys import CourseKey logger = logging.getLogger(__name__) # pylint: disable=invalid-name
from opaque_keys.edx.locations import SlashSeparatedCourseKey
class RollbackException(Exception):
"""
Exception raised explicitly to cause a database transaction rollback.
"""
pass
class Command(BaseCommand): class Command(BaseCommand):
...@@ -15,17 +29,17 @@ class Command(BaseCommand): ...@@ -15,17 +29,17 @@ class Command(BaseCommand):
Example: Example:
Change enrollment for user joe from audit to honor: Change enrollment for users joe, frank, and bill from audit to honor:
$ ... change_enrollment -u joe,frank,bill -c some/course/id --from audit --to honor $ ... change_enrollment -u joe,frank,bill -c some/course/id --from audit --to honor
Or Or
$ ... change_enrollment -u "joe@example.com,frank@example.com,bill@example.com" -c some/course/id --from audit --to honor $ ... change_enrollment -e "joe@example.com,frank@example.com,bill@example.com" -c some/course/id --from audit --to honor
Change enrollment for all users in some/course/id from audit to honor See what would have been changed from audit to honor without making that change
$ ... change_enrollment -c some/course/id --from audit --to honor $ ... change_enrollment -u joe,frank,bill -c some/course/id --from audit --to honor -n
""" """
...@@ -40,11 +54,16 @@ class Command(BaseCommand): ...@@ -40,11 +54,16 @@ class Command(BaseCommand):
dest='to_mode', dest='to_mode',
default=False, default=False,
help='move to this enrollment mode'), help='move to this enrollment mode'),
make_option('-u', '--user', make_option('-u', '--usernames',
metavar='USER', metavar='USERNAME',
dest='user', dest='username',
default=False,
help="Comma-separated list of usernames to move in the course"),
make_option('-e', '--emails',
metavar='EMAIL',
dest='email',
default=False, default=False,
help="Comma-separated list of users to move in the course"), help="Comma-separated list of email addresses to move in the course"),
make_option('-c', '--course', make_option('-c', '--course',
metavar='COURSE_ID', metavar='COURSE_ID',
dest='course_id', dest='course_id',
...@@ -59,8 +78,11 @@ class Command(BaseCommand): ...@@ -59,8 +78,11 @@ class Command(BaseCommand):
) )
def handle(self, *args, **options): def handle(self, *args, **options):
error_users = []
success_users = []
if not options['course_id']: if not options['course_id']:
raise CommandError("You must specify a course id for this command") raise CommandError('You must specify a course id for this command')
if not options['from_mode'] or not options['to_mode']: if not options['from_mode'] or not options['to_mode']:
raise CommandError('You must specify a "to" and "from" mode as parameters') raise CommandError('You must specify a "to" and "from" mode as parameters')
...@@ -69,26 +91,55 @@ class Command(BaseCommand): ...@@ -69,26 +91,55 @@ class Command(BaseCommand):
except InvalidKeyError: except InvalidKeyError:
course_key = SlashSeparatedCourseKey.from_deprecated_string(options['course_id']) course_key = SlashSeparatedCourseKey.from_deprecated_string(options['course_id'])
filter_args = dict( enrollment_args = dict(
course_id=course_key, course_id=course_key,
mode=options['from_mode'] mode=options['from_mode']
) )
if options['user']:
user_str = options['user'] if options['username']:
for username in user_str.split(","): self.update_enrollments('username', enrollment_args, options, error_users, success_users)
if '@' in username:
user = User.objects.get(email=username) if options['email']:
else: self.update_enrollments('email', enrollment_args, options, error_users, success_users)
user = User.objects.get(username=username)
filter_args['user'] = user self.report(error_users, success_users)
enrollments = CourseEnrollment.objects.filter(**filter_args)
if options['noop']: def update_enrollments(self, identifier, enrollment_args, options, error_users, success_users):
print "Would have changed {num_enrollments} students from {from_mode} to {to_mode}".format( """ Update enrollments for a specific user identifier (email or username). """
num_enrollments=enrollments.count(), users = options[identifier].split(",")
from_mode=options['from_mode'], for identified_user in users:
to_mode=options['to_mode'] logger.info(identified_user)
) try:
else: user_args = {
identifier: identified_user
}
enrollment_args['user'] = User.objects.get(**user_args)
enrollments = CourseEnrollment.objects.filter(**enrollment_args)
with transaction.atomic():
for enrollment in enrollments: for enrollment in enrollments:
enrollment.update_enrollment(mode=options['to_mode']) enrollment.update_enrollment(mode=options['to_mode'])
enrollment.save() enrollment.save()
if options['noop']:
raise RollbackException('Forced rollback.')
except RollbackException:
success_users.append(identified_user)
continue
except Exception as exception: # pylint: disable=broad-except
error_users.append((identified_user, exception))
continue
success_users.append(identified_user)
logger.info('Updated user [%s] to mode [%s]', identified_user, options['to_mode'])
def report(self, error_users, success_users):
""" Log and overview of the results of the command. """
total_users = len(success_users) + len(error_users)
logger.info('Successfully updated %i out of %i users', len(success_users), total_users)
if len(error_users) > 0:
logger.info('The following %i user(s) not saved:', len(error_users))
for user, error in error_users:
logger.info('user: [%s] reason: [%s] %s', user, type(error).__name__, error.message)
...@@ -97,9 +97,7 @@ class Command(BaseCommand): ...@@ -97,9 +97,7 @@ class Command(BaseCommand):
cert_grades = { cert_grades = {
cert.user.username: cert.grade cert.user.username: cert.grade
for cert in list( for cert in list(
GeneratedCertificate.objects.filter( # pylint: disable=no-member GeneratedCertificate.objects.filter(course_id=course_key).prefetch_related('user')
course_id=course_key
).prefetch_related('user')
) )
} }
print "Grading students" print "Grading students"
......
""" Test the change_enrollment command line script."""
import ddt
from mock import patch
from django.core.management import call_command
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from student.tests.factories import UserFactory, CourseModeFactory
from student.models import CourseEnrollment
@ddt.ddt
class ChangeEnrollmentTests(SharedModuleStoreTestCase):
""" Test the enrollment change functionality of the change_enrollment script."""
def setUp(self):
super(ChangeEnrollmentTests, self).setUp()
self.course = CourseFactory.create()
self.audit_mode = CourseModeFactory.create(
course_id=self.course.id,
mode_slug='audit',
mode_display_name='Audit',
)
self.honor_mode = CourseModeFactory.create(
course_id=self.course.id,
mode_slug='honor',
mode_display_name='Honor',
)
self.user_info = [
('amy', 'amy@pond.com', 'password'),
('rory', 'rory@theroman.com', 'password'),
('river', 'river@song.com', 'password')
]
self.enrollments = []
self.users = []
for username, email, password in self.user_info:
user = UserFactory.create(username=username, email=email, password=password)
self.users.append(user)
self.enrollments.append(CourseEnrollment.enroll(user, self.course.id, mode='audit'))
@patch('student.management.commands.change_enrollment.logger')
@ddt.data(
('email', False, 3),
('username', False, 3),
('email', True, 0),
('username', True, 0),
)
@ddt.unpack
def test_convert_users(self, method, noop, expected_conversions, mock_logger):
""" The command should update the user's enrollment. """
user_str = ','.join([getattr(user, method) for user in self.users])
user_ids = [u.id for u in self.users]
command_args = {
'course_id': unicode(self.course.id),
'to_mode': 'honor',
'from_mode': 'audit',
'noop': noop,
method: user_str,
}
# Verify users are not in honor mode yet
self.assertEqual(
len(CourseEnrollment.objects.filter(mode='honor', user_id__in=user_ids)),
0
)
call_command(
'change_enrollment',
**command_args
)
# Verify correct number of users are now in honor mode
self.assertEqual(
len(CourseEnrollment.objects.filter(mode='honor', user_id__in=user_ids)),
expected_conversions
)
mock_logger.info.assert_called_with(
'Successfully updated %i out of %i users',
len(self.users),
len(self.users)
)
@patch('student.management.commands.change_enrollment.logger')
@ddt.data(
('email', 'dtennant@thedoctor.com', 3),
('username', 'dtennant', 3),
)
@ddt.unpack
def test_user_not_found(self, method, fake_user, expected_success, mock_logger):
all_users = [getattr(user, method) for user in self.users]
all_users.append(fake_user)
user_str = ','.join(all_users)
real_user_ids = [u.id for u in self.users]
command_args = {
'course_id': unicode(self.course.id),
'to_mode': 'honor',
'from_mode': 'audit',
method: user_str,
}
# Verify users are not in honor mode yet
self.assertEqual(
len(CourseEnrollment.objects.filter(mode='honor', user_id__in=real_user_ids)),
0
)
call_command(
'change_enrollment',
**command_args
)
# Verify correct number of users are now in honor mode
self.assertEqual(
len(CourseEnrollment.objects.filter(mode='honor', user_id__in=real_user_ids)),
expected_success
)
mock_logger.info.assert_called_with(
'user: [%s] reason: [%s] %s', fake_user, 'DoesNotExist', 'User matching query does not exist.'
)
This source diff could not be displayed because it is too large. You can view the blob instead.
-- MySQL dump 10.13 Distrib 5.6.14, for debian-linux-gnu (x86_64) -- MySQL dump 10.13 Distrib 5.6.24, for debian-linux-gnu (x86_64)
-- --
-- Host: localhost Database: edxtest -- Host: localhost Database: edxtest
-- ------------------------------------------------------ -- ------------------------------------------------------
-- Server version 5.6.14-1+debphp.org~precise+1 -- Server version 5.6.24-2+deb.sury.org~precise+2
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
LOCK TABLES `django_migrations` WRITE; LOCK TABLES `django_migrations` WRITE;
/*!40000 ALTER TABLE `django_migrations` DISABLE KEYS */; /*!40000 ALTER TABLE `django_migrations` DISABLE KEYS */;
INSERT INTO `django_migrations` VALUES (1,'contenttypes','0001_initial','2016-01-13 15:54:59.103917'),(2,'auth','0001_initial','2016-01-13 15:54:59.548188'),(3,'admin','0001_initial','2016-01-13 15:54:59.671513'),(4,'assessment','0001_initial','2016-01-13 15:55:05.356361'),(5,'contenttypes','0002_remove_content_type_name','2016-01-13 15:55:05.540600'),(6,'auth','0002_alter_permission_name_max_length','2016-01-13 15:55:05.628282'),(7,'auth','0003_alter_user_email_max_length','2016-01-13 15:55:05.703955'),(8,'auth','0004_alter_user_username_opts','2016-01-13 15:55:05.738607'),(9,'auth','0005_alter_user_last_login_null','2016-01-13 15:55:05.812885'),(10,'auth','0006_require_contenttypes_0002','2016-01-13 15:55:05.818909'),(11,'bookmarks','0001_initial','2016-01-13 15:55:06.198185'),(12,'branding','0001_initial','2016-01-13 15:55:06.364584'),(13,'bulk_email','0001_initial','2016-01-13 15:55:06.717518'),(14,'bulk_email','0002_data__load_course_email_template','2016-01-13 15:55:06.796406'),(15,'instructor_task','0001_initial','2016-01-13 15:55:07.024831'),(16,'certificates','0001_initial','2016-01-13 15:55:08.148002'),(17,'certificates','0002_data__certificatehtmlviewconfiguration_data','2016-01-13 15:55:08.177219'),(18,'certificates','0003_data__default_modes','2016-01-13 15:55:08.266996'),(19,'certificates','0004_certificategenerationhistory','2016-01-13 15:55:08.467941'),(20,'certificates','0005_auto_20151208_0801','2016-01-13 15:55:08.574292'),(21,'certificates','0006_certificatetemplateasset_asset_slug','2016-01-13 15:55:08.632221'),(22,'certificates','0007_certificateinvalidation','2016-01-13 15:55:08.799106'),(23,'certificates','0008_generatedcertificate_eligible_for_certificate','2016-01-13 15:55:08.945467'),(24,'commerce','0001_data__add_ecommerce_service_user','2016-01-13 15:55:08.974419'),(25,'cors_csrf','0001_initial','2016-01-13 15:55:09.107159'),(26,'course_action_state','0001_initial','2016-01-13 15:55:09.521536'),(27,'course_groups','0001_initial','2016-01-13 15:55:10.771047'),(28,'course_modes','0001_initial','2016-01-13 15:55:10.940717'),(29,'course_modes','0002_coursemode_expiration_datetime_is_explicit','2016-01-13 15:55:11.013026'),(30,'course_modes','0003_auto_20151113_1443','2016-01-13 15:55:11.044928'),(31,'course_modes','0004_auto_20151113_1457','2016-01-13 15:55:11.201105'),(32,'course_modes','0005_auto_20151217_0958','2016-01-13 15:55:11.355769'),(33,'course_overviews','0001_initial','2016-01-13 15:55:11.466407'),(34,'course_overviews','0002_add_course_catalog_fields','2016-01-13 15:55:11.769083'),(35,'course_overviews','0003_courseoverviewgeneratedhistory','2016-01-13 15:55:11.805665'),(36,'course_overviews','0004_courseoverview_org','2016-01-13 15:55:11.872106'),(37,'course_overviews','0005_delete_courseoverviewgeneratedhistory','2016-01-13 15:55:11.899770'),(38,'course_overviews','0006_courseoverviewimageset','2016-01-13 15:55:11.978558'),(39,'course_overviews','0007_courseoverviewimageconfig','2016-01-13 15:55:12.149570'),(40,'course_structures','0001_initial','2016-01-13 15:55:12.194268'),(41,'courseware','0001_initial','2016-01-13 15:55:15.115543'),(42,'credit','0001_initial','2016-01-13 15:55:17.160533'),(43,'dark_lang','0001_initial','2016-01-13 15:55:17.404251'),(44,'dark_lang','0002_data__enable_on_install','2016-01-13 15:55:17.437609'),(45,'default','0001_initial','2016-01-13 15:55:18.898722'),(46,'default','0002_add_related_name','2016-01-13 15:55:19.137245'),(47,'default','0003_alter_email_max_length','2016-01-13 15:55:19.225960'),(48,'django_comment_common','0001_initial','2016-01-13 15:55:19.853226'),(49,'django_notify','0001_initial','2016-01-13 15:55:21.035600'),(50,'django_openid_auth','0001_initial','2016-01-13 15:55:21.413206'),(51,'edx_proctoring','0001_initial','2016-01-13 15:55:27.121600'),(52,'edx_proctoring','0002_proctoredexamstudentattempt_is_status_acknowledged','2016-01-13 15:55:27.549954'),(53,'edx_proctoring','0003_auto_20160101_0525','2016-01-13 15:55:28.212468'),(54,'edxval','0001_initial','2016-01-13 15:55:29.329480'),(55,'edxval','0002_data__default_profiles','2016-01-13 15:55:29.369875'),(56,'embargo','0001_initial','2016-01-13 15:55:31.695697'),(57,'embargo','0002_data__add_countries','2016-01-13 15:55:32.149108'),(58,'external_auth','0001_initial','2016-01-13 15:55:32.984578'),(59,'lms_xblock','0001_initial','2016-01-13 15:55:33.385819'),(60,'milestones','0001_initial','2016-01-13 15:55:35.154418'),(61,'milestones','0002_data__seed_relationship_types','2016-01-13 15:55:35.212445'),(62,'mobile_api','0001_initial','2016-01-13 15:55:35.725285'),(63,'notes','0001_initial','2016-01-13 15:55:36.313648'),(64,'oauth2','0001_initial','2016-01-13 15:55:38.753301'),(65,'oauth2_provider','0001_initial','2016-01-13 15:55:39.241072'),(66,'oauth_provider','0001_initial','2016-01-13 15:55:40.421055'),(67,'organizations','0001_initial','2016-01-13 15:55:40.764953'),(68,'programs','0001_initial','2016-01-13 15:55:41.312674'),(69,'programs','0002_programsapiconfig_cache_ttl','2016-01-13 15:55:41.859310'),(70,'programs','0003_auto_20151120_1613','2016-01-13 15:55:44.646083'),(71,'self_paced','0001_initial','2016-01-13 15:55:45.201162'),(72,'sessions','0001_initial','2016-01-13 15:55:45.287058'),(73,'student','0001_initial','2016-01-13 15:56:03.114545'),(74,'shoppingcart','0001_initial','2016-01-13 15:56:21.665323'),(75,'shoppingcart','0002_auto_20151208_1034','2016-01-13 15:56:23.446763'),(76,'shoppingcart','0003_auto_20151217_0958','2016-01-13 15:56:25.521891'),(77,'sites','0001_initial','2016-01-13 15:56:25.597976'),(78,'splash','0001_initial','2016-01-13 15:56:26.484160'),(79,'static_replace','0001_initial','2016-01-13 15:56:28.174868'),(80,'status','0001_initial','2016-01-13 15:56:29.928034'),(81,'student','0002_auto_20151208_1034','2016-01-13 15:56:31.565605'),(82,'submissions','0001_initial','2016-01-13 15:56:33.161619'),(83,'submissions','0002_auto_20151119_0913','2016-01-13 15:56:33.464020'),(84,'survey','0001_initial','2016-01-13 15:56:34.709913'),(85,'teams','0001_initial','2016-01-13 15:56:37.905886'),(86,'third_party_auth','0001_initial','2016-01-13 15:56:44.139515'),(87,'track','0001_initial','2016-01-13 15:56:44.223718'),(88,'user_api','0001_initial','2016-01-13 15:56:49.437247'),(89,'util','0001_initial','2016-01-13 15:56:50.264911'),(90,'util','0002_data__default_rate_limit_config','2016-01-13 15:56:50.324304'),(91,'verify_student','0001_initial','2016-01-13 15:57:00.956112'),(92,'verify_student','0002_auto_20151124_1024','2016-01-13 15:57:02.074019'),(93,'verify_student','0003_auto_20151113_1443','2016-01-13 15:57:03.003678'),(94,'wiki','0001_initial','2016-01-13 15:57:34.407098'),(95,'wiki','0002_remove_article_subscription','2016-01-13 15:57:34.476852'),(96,'workflow','0001_initial','2016-01-13 15:57:35.379764'),(97,'xblock_django','0001_initial','2016-01-13 15:57:36.446458'),(98,'contentstore','0001_initial','2016-01-13 15:58:05.082690'),(99,'course_creators','0001_initial','2016-01-13 15:58:05.178077'),(100,'xblock_config','0001_initial','2016-01-13 15:58:05.553582'); INSERT INTO `django_migrations` VALUES (1,'contenttypes','0001_initial','2016-01-20 14:41:07.526997'),(2,'auth','0001_initial','2016-01-20 14:41:07.726373'),(3,'admin','0001_initial','2016-01-20 14:41:07.784817'),(4,'assessment','0001_initial','2016-01-20 14:41:10.128520'),(5,'assessment','0002_staffworkflow','2016-01-20 14:41:10.278895'),(6,'contenttypes','0002_remove_content_type_name','2016-01-20 14:41:10.400860'),(7,'auth','0002_alter_permission_name_max_length','2016-01-20 14:41:10.443454'),(8,'auth','0003_alter_user_email_max_length','2016-01-20 14:41:10.484951'),(9,'auth','0004_alter_user_username_opts','2016-01-20 14:41:10.513064'),(10,'auth','0005_alter_user_last_login_null','2016-01-20 14:41:10.564318'),(11,'auth','0006_require_contenttypes_0002','2016-01-20 14:41:10.568611'),(12,'bookmarks','0001_initial','2016-01-20 14:41:10.803931'),(13,'branding','0001_initial','2016-01-20 14:41:10.906337'),(14,'bulk_email','0001_initial','2016-01-20 14:41:11.151139'),(15,'bulk_email','0002_data__load_course_email_template','2016-01-20 14:41:11.205606'),(16,'instructor_task','0001_initial','2016-01-20 14:41:11.353835'),(17,'certificates','0001_initial','2016-01-20 14:41:12.112097'),(18,'certificates','0002_data__certificatehtmlviewconfiguration_data','2016-01-20 14:41:12.128293'),(19,'certificates','0003_data__default_modes','2016-01-20 14:41:12.183520'),(20,'certificates','0004_certificategenerationhistory','2016-01-20 14:41:12.278412'),(21,'certificates','0005_auto_20151208_0801','2016-01-20 14:41:12.352092'),(22,'certificates','0006_certificatetemplateasset_asset_slug','2016-01-20 14:41:12.395731'),(23,'certificates','0007_certificateinvalidation','2016-01-20 14:41:12.498599'),(24,'commerce','0001_data__add_ecommerce_service_user','2016-01-20 14:41:12.529863'),(25,'cors_csrf','0001_initial','2016-01-20 14:41:12.617653'),(26,'course_action_state','0001_initial','2016-01-20 14:41:12.847868'),(27,'course_groups','0001_initial','2016-01-20 14:41:13.684872'),(28,'course_modes','0001_initial','2016-01-20 14:41:13.797175'),(29,'course_modes','0002_coursemode_expiration_datetime_is_explicit','2016-01-20 14:41:13.840711'),(30,'course_modes','0003_auto_20151113_1443','2016-01-20 14:41:13.864277'),(31,'course_modes','0004_auto_20151113_1457','2016-01-20 14:41:13.965096'),(32,'course_modes','0005_auto_20151217_0958','2016-01-20 14:41:13.988812'),(33,'course_overviews','0001_initial','2016-01-20 14:41:14.053338'),(34,'course_overviews','0002_add_course_catalog_fields','2016-01-20 14:41:14.268029'),(35,'course_overviews','0003_courseoverviewgeneratedhistory','2016-01-20 14:41:14.298244'),(36,'course_overviews','0004_courseoverview_org','2016-01-20 14:41:14.345271'),(37,'course_overviews','0005_delete_courseoverviewgeneratedhistory','2016-01-20 14:41:14.365007'),(38,'course_overviews','0006_courseoverviewimageset','2016-01-20 14:41:14.414683'),(39,'course_overviews','0007_courseoverviewimageconfig','2016-01-20 14:41:14.534225'),(40,'course_structures','0001_initial','2016-01-20 14:41:14.563672'),(41,'courseware','0001_initial','2016-01-20 14:41:17.072208'),(42,'credit','0001_initial','2016-01-20 14:41:18.296459'),(43,'dark_lang','0001_initial','2016-01-20 14:41:18.462718'),(44,'dark_lang','0002_data__enable_on_install','2016-01-20 14:41:18.485177'),(45,'default','0001_initial','2016-01-20 14:41:18.942718'),(46,'default','0002_add_related_name','2016-01-20 14:41:19.099131'),(47,'default','0003_alter_email_max_length','2016-01-20 14:41:19.151838'),(48,'django_comment_common','0001_initial','2016-01-20 14:41:19.578955'),(49,'django_notify','0001_initial','2016-01-20 14:41:20.337949'),(50,'django_openid_auth','0001_initial','2016-01-20 14:41:20.596247'),(51,'edx_proctoring','0001_initial','2016-01-20 14:41:24.214955'),(52,'edx_proctoring','0002_proctoredexamstudentattempt_is_status_acknowledged','2016-01-20 14:41:24.444760'),(53,'edx_proctoring','0003_auto_20160101_0525','2016-01-20 14:41:24.833049'),(54,'edxval','0001_initial','2016-01-20 14:41:25.427779'),(55,'edxval','0002_data__default_profiles','2016-01-20 14:41:25.463777'),(56,'embargo','0001_initial','2016-01-20 14:41:26.272910'),(57,'embargo','0002_data__add_countries','2016-01-20 14:41:26.737671'),(58,'external_auth','0001_initial','2016-01-20 14:41:27.265404'),(59,'lms_xblock','0001_initial','2016-01-20 14:41:27.513483'),(60,'sites','0001_initial','2016-01-20 14:41:27.552225'),(61,'microsite_configuration','0001_initial','2016-01-20 14:41:29.182124'),(62,'milestones','0001_initial','2016-01-20 14:41:30.032773'),(63,'milestones','0002_data__seed_relationship_types','2016-01-20 14:41:30.062215'),(64,'mobile_api','0001_initial','2016-01-20 14:41:31.131359'),(65,'notes','0001_initial','2016-01-20 14:41:31.450145'),(66,'oauth2','0001_initial','2016-01-20 14:41:33.047753'),(67,'oauth2_provider','0001_initial','2016-01-20 14:41:33.354602'),(68,'oauth_provider','0001_initial','2016-01-20 14:41:34.123404'),(69,'organizations','0001_initial','2016-01-20 14:41:34.306167'),(70,'programs','0001_initial','2016-01-20 14:41:34.667945'),(71,'programs','0002_programsapiconfig_cache_ttl','2016-01-20 14:41:35.039084'),(72,'programs','0003_auto_20151120_1613','2016-01-20 14:41:36.598370'),(73,'self_paced','0001_initial','2016-01-20 14:41:37.022438'),(74,'sessions','0001_initial','2016-01-20 14:41:37.084035'),(75,'student','0001_initial','2016-01-20 14:41:50.300194'),(76,'shoppingcart','0001_initial','2016-01-20 14:42:01.691856'),(77,'shoppingcart','0002_auto_20151208_1034','2016-01-20 14:42:02.755800'),(78,'shoppingcart','0003_auto_20151217_0958','2016-01-20 14:42:03.899845'),(79,'splash','0001_initial','2016-01-20 14:42:04.512949'),(80,'static_replace','0001_initial','2016-01-20 14:42:05.137223'),(81,'status','0001_initial','2016-01-20 14:42:06.482955'),(82,'student','0002_auto_20151208_1034','2016-01-20 14:42:07.829316'),(83,'submissions','0001_initial','2016-01-20 14:42:09.437492'),(84,'submissions','0002_auto_20151119_0913','2016-01-20 14:42:09.600508'),(85,'survey','0001_initial','2016-01-20 14:42:10.318588'),(86,'teams','0001_initial','2016-01-20 14:42:11.936107'),(87,'third_party_auth','0001_initial','2016-01-20 14:42:15.174455'),(88,'track','0001_initial','2016-01-20 14:42:15.224831'),(89,'user_api','0001_initial','2016-01-20 14:42:19.893671'),(90,'util','0001_initial','2016-01-20 14:42:20.651574'),(91,'util','0002_data__default_rate_limit_config','2016-01-20 14:42:20.697520'),(92,'verify_student','0001_initial','2016-01-20 14:42:29.518686'),(93,'verify_student','0002_auto_20151124_1024','2016-01-20 14:42:30.174493'),(94,'verify_student','0003_auto_20151113_1443','2016-01-20 14:42:30.800853'),(95,'wiki','0001_initial','2016-01-20 14:42:53.258049'),(96,'wiki','0002_remove_article_subscription','2016-01-20 14:42:53.309640'),(97,'workflow','0001_initial','2016-01-20 14:42:53.600810'),(98,'xblock_django','0001_initial','2016-01-20 14:42:54.367498'),(99,'contentstore','0001_initial','2016-01-20 14:43:14.629049'),(100,'course_creators','0001_initial','2016-01-20 14:43:14.692740'),(101,'xblock_config','0001_initial','2016-01-20 14:43:14.954953');
/*!40000 ALTER TABLE `django_migrations` ENABLE KEYS */; /*!40000 ALTER TABLE `django_migrations` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
...@@ -34,4 +34,4 @@ UNLOCK TABLES; ...@@ -34,4 +34,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-01-13 15:58:11 -- Dump completed on 2016-01-20 14:43:18
...@@ -20,8 +20,8 @@ CREATE TABLE `assessment_aiclassifier` ( ...@@ -20,8 +20,8 @@ CREATE TABLE `assessment_aiclassifier` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `assessment_aiclassifier_962f069f` (`classifier_set_id`), KEY `assessment_aiclassifier_962f069f` (`classifier_set_id`),
KEY `assessment_aiclassifier_385b00a3` (`criterion_id`), KEY `assessment_aiclassifier_385b00a3` (`criterion_id`),
CONSTRAINT `assessm_criterion_id_275db29f2a0e1711_fk_assessment_criterion_id` FOREIGN KEY (`criterion_id`) REFERENCES `assessment_criterion` (`id`), CONSTRAINT `D3bd45d5e3c9cfdc4f3b442119adebe8` FOREIGN KEY (`classifier_set_id`) REFERENCES `assessment_aiclassifierset` (`id`),
CONSTRAINT `D3bd45d5e3c9cfdc4f3b442119adebe8` FOREIGN KEY (`classifier_set_id`) REFERENCES `assessment_aiclassifierset` (`id`) CONSTRAINT `assessm_criterion_id_275db29f2a0e1711_fk_assessment_criterion_id` FOREIGN KEY (`criterion_id`) REFERENCES `assessment_criterion` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_aiclassifierset`; DROP TABLE IF EXISTS `assessment_aiclassifierset`;
...@@ -72,9 +72,9 @@ CREATE TABLE `assessment_aigradingworkflow` ( ...@@ -72,9 +72,9 @@ CREATE TABLE `assessment_aigradingworkflow` (
KEY `assessment_aigradingworkflow_a4079fcf` (`assessment_id`), KEY `assessment_aigradingworkflow_a4079fcf` (`assessment_id`),
KEY `assessment_aigradingworkflow_962f069f` (`classifier_set_id`), KEY `assessment_aigradingworkflow_962f069f` (`classifier_set_id`),
KEY `assessment_aigradingworkflow_8980b7ae` (`rubric_id`), KEY `assessment_aigradingworkflow_8980b7ae` (`rubric_id`),
CONSTRAINT `assessment_ai_rubric_id_3fc938e9e3ae7b2d_fk_assessment_rubric_id` FOREIGN KEY (`rubric_id`) REFERENCES `assessment_rubric` (`id`), CONSTRAINT `D4d9bca115376aeb07fd970155499db3` FOREIGN KEY (`classifier_set_id`) REFERENCES `assessment_aiclassifierset` (`id`),
CONSTRAINT `asses_assessment_id_68b86880a7f62f1c_fk_assessment_assessment_id` FOREIGN KEY (`assessment_id`) REFERENCES `assessment_assessment` (`id`), CONSTRAINT `asses_assessment_id_68b86880a7f62f1c_fk_assessment_assessment_id` FOREIGN KEY (`assessment_id`) REFERENCES `assessment_assessment` (`id`),
CONSTRAINT `D4d9bca115376aeb07fd970155499db3` FOREIGN KEY (`classifier_set_id`) REFERENCES `assessment_aiclassifierset` (`id`) CONSTRAINT `assessment_ai_rubric_id_3fc938e9e3ae7b2d_fk_assessment_rubric_id` FOREIGN KEY (`rubric_id`) REFERENCES `assessment_rubric` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_aitrainingworkflow`; DROP TABLE IF EXISTS `assessment_aitrainingworkflow`;
...@@ -110,8 +110,8 @@ CREATE TABLE `assessment_aitrainingworkflow_training_examples` ( ...@@ -110,8 +110,8 @@ CREATE TABLE `assessment_aitrainingworkflow_training_examples` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `aitrainingworkflow_id` (`aitrainingworkflow_id`,`trainingexample_id`), UNIQUE KEY `aitrainingworkflow_id` (`aitrainingworkflow_id`,`trainingexample_id`),
KEY `ff4ddecc43bd06c0d85785a61e955133` (`trainingexample_id`), KEY `ff4ddecc43bd06c0d85785a61e955133` (`trainingexample_id`),
CONSTRAINT `ff4ddecc43bd06c0d85785a61e955133` FOREIGN KEY (`trainingexample_id`) REFERENCES `assessment_trainingexample` (`id`), CONSTRAINT `da55be90caee21d95136e40c53e5c754` FOREIGN KEY (`aitrainingworkflow_id`) REFERENCES `assessment_aitrainingworkflow` (`id`),
CONSTRAINT `da55be90caee21d95136e40c53e5c754` FOREIGN KEY (`aitrainingworkflow_id`) REFERENCES `assessment_aitrainingworkflow` (`id`) CONSTRAINT `ff4ddecc43bd06c0d85785a61e955133` FOREIGN KEY (`trainingexample_id`) REFERENCES `assessment_trainingexample` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_assessment`; DROP TABLE IF EXISTS `assessment_assessment`;
...@@ -154,8 +154,8 @@ CREATE TABLE `assessment_assessmentfeedback_assessments` ( ...@@ -154,8 +154,8 @@ CREATE TABLE `assessment_assessmentfeedback_assessments` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `assessmentfeedback_id` (`assessmentfeedback_id`,`assessment_id`), UNIQUE KEY `assessmentfeedback_id` (`assessmentfeedback_id`,`assessment_id`),
KEY `asses_assessment_id_392d354eca2e0c87_fk_assessment_assessment_id` (`assessment_id`), KEY `asses_assessment_id_392d354eca2e0c87_fk_assessment_assessment_id` (`assessment_id`),
CONSTRAINT `asses_assessment_id_392d354eca2e0c87_fk_assessment_assessment_id` FOREIGN KEY (`assessment_id`) REFERENCES `assessment_assessment` (`id`), CONSTRAINT `D1fc3fa7cd7be79d20561668a95a9fc1` FOREIGN KEY (`assessmentfeedback_id`) REFERENCES `assessment_assessmentfeedback` (`id`),
CONSTRAINT `D1fc3fa7cd7be79d20561668a95a9fc1` FOREIGN KEY (`assessmentfeedback_id`) REFERENCES `assessment_assessmentfeedback` (`id`) CONSTRAINT `asses_assessment_id_392d354eca2e0c87_fk_assessment_assessment_id` FOREIGN KEY (`assessment_id`) REFERENCES `assessment_assessment` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_assessmentfeedback_options`; DROP TABLE IF EXISTS `assessment_assessmentfeedback_options`;
...@@ -168,8 +168,8 @@ CREATE TABLE `assessment_assessmentfeedback_options` ( ...@@ -168,8 +168,8 @@ CREATE TABLE `assessment_assessmentfeedback_options` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `assessmentfeedback_id` (`assessmentfeedback_id`,`assessmentfeedbackoption_id`), UNIQUE KEY `assessmentfeedback_id` (`assessmentfeedback_id`,`assessmentfeedbackoption_id`),
KEY `cc7028abc88c431df3172c9b2d6422e4` (`assessmentfeedbackoption_id`), KEY `cc7028abc88c431df3172c9b2d6422e4` (`assessmentfeedbackoption_id`),
CONSTRAINT `cc7028abc88c431df3172c9b2d6422e4` FOREIGN KEY (`assessmentfeedbackoption_id`) REFERENCES `assessment_assessmentfeedbackoption` (`id`), CONSTRAINT `cba12ac98c4a04d67d5edaa2223f4fe5` FOREIGN KEY (`assessmentfeedback_id`) REFERENCES `assessment_assessmentfeedback` (`id`),
CONSTRAINT `cba12ac98c4a04d67d5edaa2223f4fe5` FOREIGN KEY (`assessmentfeedback_id`) REFERENCES `assessment_assessmentfeedback` (`id`) CONSTRAINT `cc7028abc88c431df3172c9b2d6422e4` FOREIGN KEY (`assessmentfeedbackoption_id`) REFERENCES `assessment_assessmentfeedbackoption` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_assessmentfeedbackoption`; DROP TABLE IF EXISTS `assessment_assessmentfeedbackoption`;
...@@ -196,8 +196,8 @@ CREATE TABLE `assessment_assessmentpart` ( ...@@ -196,8 +196,8 @@ CREATE TABLE `assessment_assessmentpart` (
KEY `assessment_assessmentpart_385b00a3` (`criterion_id`), KEY `assessment_assessmentpart_385b00a3` (`criterion_id`),
KEY `assessment_assessmentpart_28df3725` (`option_id`), KEY `assessment_assessmentpart_28df3725` (`option_id`),
CONSTRAINT `asse_option_id_2508a14feeabf4ce_fk_assessment_criterionoption_id` FOREIGN KEY (`option_id`) REFERENCES `assessment_criterionoption` (`id`), CONSTRAINT `asse_option_id_2508a14feeabf4ce_fk_assessment_criterionoption_id` FOREIGN KEY (`option_id`) REFERENCES `assessment_criterionoption` (`id`),
CONSTRAINT `assessm_criterion_id_2061f2359fd292bf_fk_assessment_criterion_id` FOREIGN KEY (`criterion_id`) REFERENCES `assessment_criterion` (`id`), CONSTRAINT `asses_assessment_id_1d752290138ce479_fk_assessment_assessment_id` FOREIGN KEY (`assessment_id`) REFERENCES `assessment_assessment` (`id`),
CONSTRAINT `asses_assessment_id_1d752290138ce479_fk_assessment_assessment_id` FOREIGN KEY (`assessment_id`) REFERENCES `assessment_assessment` (`id`) CONSTRAINT `assessm_criterion_id_2061f2359fd292bf_fk_assessment_criterion_id` FOREIGN KEY (`criterion_id`) REFERENCES `assessment_criterion` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_criterion`; DROP TABLE IF EXISTS `assessment_criterion`;
...@@ -272,9 +272,9 @@ CREATE TABLE `assessment_peerworkflowitem` ( ...@@ -272,9 +272,9 @@ CREATE TABLE `assessment_peerworkflowitem` (
KEY `assessm_scorer_id_2d803ee2d52c0e2c_fk_assessment_peerworkflow_id` (`scorer_id`), KEY `assessm_scorer_id_2d803ee2d52c0e2c_fk_assessment_peerworkflow_id` (`scorer_id`),
KEY `assessment_peerworkflowitem_ab5b2b73` (`submission_uuid`), KEY `assessment_peerworkflowitem_ab5b2b73` (`submission_uuid`),
KEY `assessment_peerworkflowitem_ff1ae11b` (`started_at`), KEY `assessment_peerworkflowitem_ff1ae11b` (`started_at`),
CONSTRAINT `assessm_scorer_id_2d803ee2d52c0e2c_fk_assessment_peerworkflow_id` FOREIGN KEY (`scorer_id`) REFERENCES `assessment_peerworkflow` (`id`), CONSTRAINT `asses_assessment_id_15cadfae90ddcc2a_fk_assessment_assessment_id` FOREIGN KEY (`assessment_id`) REFERENCES `assessment_assessment` (`id`),
CONSTRAINT `assessm_author_id_1948f89dea6d2b5f_fk_assessment_peerworkflow_id` FOREIGN KEY (`author_id`) REFERENCES `assessment_peerworkflow` (`id`), CONSTRAINT `assessm_author_id_1948f89dea6d2b5f_fk_assessment_peerworkflow_id` FOREIGN KEY (`author_id`) REFERENCES `assessment_peerworkflow` (`id`),
CONSTRAINT `asses_assessment_id_15cadfae90ddcc2a_fk_assessment_assessment_id` FOREIGN KEY (`assessment_id`) REFERENCES `assessment_assessment` (`id`) CONSTRAINT `assessm_scorer_id_2d803ee2d52c0e2c_fk_assessment_peerworkflow_id` FOREIGN KEY (`scorer_id`) REFERENCES `assessment_peerworkflow` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_rubric`; DROP TABLE IF EXISTS `assessment_rubric`;
...@@ -289,6 +289,32 @@ CREATE TABLE `assessment_rubric` ( ...@@ -289,6 +289,32 @@ CREATE TABLE `assessment_rubric` (
KEY `assessment_rubric_873e9e2d` (`structure_hash`) KEY `assessment_rubric_873e9e2d` (`structure_hash`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_staffworkflow`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `assessment_staffworkflow` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`scorer_id` varchar(40) NOT NULL,
`course_id` varchar(40) NOT NULL,
`item_id` varchar(128) NOT NULL,
`submission_uuid` varchar(128) NOT NULL,
`created_at` datetime(6) NOT NULL,
`grading_completed_at` datetime(6) DEFAULT NULL,
`grading_started_at` datetime(6) DEFAULT NULL,
`cancelled_at` datetime(6) DEFAULT NULL,
`assessment` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `submission_uuid` (`submission_uuid`),
KEY `assessment_staffworkflow_7b0042c0` (`scorer_id`),
KEY `assessment_staffworkflow_ea134da7` (`course_id`),
KEY `assessment_staffworkflow_82bfda79` (`item_id`),
KEY `assessment_staffworkflow_fde81f11` (`created_at`),
KEY `assessment_staffworkflow_85d183d8` (`grading_completed_at`),
KEY `assessment_staffworkflow_0af9deae` (`grading_started_at`),
KEY `assessment_staffworkflow_740da1db` (`cancelled_at`),
KEY `assessment_staffworkflow_5096c410` (`assessment`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_studenttrainingworkflow`; DROP TABLE IF EXISTS `assessment_studenttrainingworkflow`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
...@@ -319,8 +345,8 @@ CREATE TABLE `assessment_studenttrainingworkflowitem` ( ...@@ -319,8 +345,8 @@ CREATE TABLE `assessment_studenttrainingworkflowitem` (
UNIQUE KEY `assessment_studenttrainingwork_workflow_id_484e930feb86ad74_uniq` (`workflow_id`,`order_num`), UNIQUE KEY `assessment_studenttrainingwork_workflow_id_484e930feb86ad74_uniq` (`workflow_id`,`order_num`),
KEY `assessment_studenttrainingworkflowitem_9cc97abc` (`training_example_id`), KEY `assessment_studenttrainingworkflowitem_9cc97abc` (`training_example_id`),
KEY `assessment_studenttrainingworkflowitem_846c77cf` (`workflow_id`), KEY `assessment_studenttrainingworkflowitem_846c77cf` (`workflow_id`),
CONSTRAINT `f9c080ebc7ad16394edda963ed3f280f` FOREIGN KEY (`workflow_id`) REFERENCES `assessment_studenttrainingworkflow` (`id`), CONSTRAINT `D74ce3e30635de397fef41ac869640c7` FOREIGN KEY (`training_example_id`) REFERENCES `assessment_trainingexample` (`id`),
CONSTRAINT `D74ce3e30635de397fef41ac869640c7` FOREIGN KEY (`training_example_id`) REFERENCES `assessment_trainingexample` (`id`) CONSTRAINT `f9c080ebc7ad16394edda963ed3f280f` FOREIGN KEY (`workflow_id`) REFERENCES `assessment_studenttrainingworkflow` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `assessment_trainingexample`; DROP TABLE IF EXISTS `assessment_trainingexample`;
...@@ -386,7 +412,7 @@ CREATE TABLE `auth_permission` ( ...@@ -386,7 +412,7 @@ CREATE TABLE `auth_permission` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `content_type_id` (`content_type_id`,`codename`), UNIQUE KEY `content_type_id` (`content_type_id`,`codename`),
CONSTRAINT `auth__content_type_id_508cf46651277a81_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) CONSTRAINT `auth__content_type_id_508cf46651277a81_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=716 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=737 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `auth_registration`; DROP TABLE IF EXISTS `auth_registration`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
...@@ -840,7 +866,6 @@ CREATE TABLE `certificates_generatedcertificate` ( ...@@ -840,7 +866,6 @@ CREATE TABLE `certificates_generatedcertificate` (
`modified_date` datetime(6) NOT NULL, `modified_date` datetime(6) NOT NULL,
`error_reason` varchar(512) NOT NULL, `error_reason` varchar(512) NOT NULL,
`user_id` int(11) NOT NULL, `user_id` int(11) NOT NULL,
`eligible_for_certificate` tinyint(1) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `certificates_generatedcertificate_user_id_552a0fa6f7d3f7e8_uniq` (`user_id`,`course_id`), UNIQUE KEY `certificates_generatedcertificate_user_id_552a0fa6f7d3f7e8_uniq` (`user_id`,`course_id`),
KEY `certificates_generatedcertific_verify_uuid_1b5a14bb83c471ff_uniq` (`verify_uuid`), KEY `certificates_generatedcertific_verify_uuid_1b5a14bb83c471ff_uniq` (`verify_uuid`),
...@@ -920,8 +945,8 @@ CREATE TABLE `course_action_state_coursererunstate` ( ...@@ -920,8 +945,8 @@ CREATE TABLE `course_action_state_coursererunstate` (
KEY `course_action_state_coursererunstate_c8235886` (`course_key`), KEY `course_action_state_coursererunstate_c8235886` (`course_key`),
KEY `course_action_state_coursererunstate_418c5509` (`action`), KEY `course_action_state_coursererunstate_418c5509` (`action`),
KEY `course_action_state_coursererunstate_a9bd7343` (`source_course_key`), KEY `course_action_state_coursererunstate_a9bd7343` (`source_course_key`),
CONSTRAINT `course_action_s_updated_user_id_4fab18012332c9a4_fk_auth_user_id` FOREIGN KEY (`updated_user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `course_action_s_created_user_id_7f53088ef8dccd0b_fk_auth_user_id` FOREIGN KEY (`created_user_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `course_action_s_created_user_id_7f53088ef8dccd0b_fk_auth_user_id` FOREIGN KEY (`created_user_id`) REFERENCES `auth_user` (`id`) CONSTRAINT `course_action_s_updated_user_id_4fab18012332c9a4_fk_auth_user_id` FOREIGN KEY (`updated_user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `course_creators_coursecreator`; DROP TABLE IF EXISTS `course_creators_coursecreator`;
...@@ -950,8 +975,8 @@ CREATE TABLE `course_groups_cohortmembership` ( ...@@ -950,8 +975,8 @@ CREATE TABLE `course_groups_cohortmembership` (
UNIQUE KEY `course_groups_cohortmembership_user_id_395bddd0389ed7da_uniq` (`user_id`,`course_id`), UNIQUE KEY `course_groups_cohortmembership_user_id_395bddd0389ed7da_uniq` (`user_id`,`course_id`),
KEY `course_groups_cohortmembership_6e438ee3` (`course_user_group_id`), KEY `course_groups_cohortmembership_6e438ee3` (`course_user_group_id`),
KEY `course_groups_cohortmembership_e8701ad4` (`user_id`), KEY `course_groups_cohortmembership_e8701ad4` (`user_id`),
CONSTRAINT `course_groups_cohortmem_user_id_15d408bf736398bf_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `D004e77c965054d46217a8bd48bcaec8` FOREIGN KEY (`course_user_group_id`) REFERENCES `course_groups_courseusergroup` (`id`),
CONSTRAINT `D004e77c965054d46217a8bd48bcaec8` FOREIGN KEY (`course_user_group_id`) REFERENCES `course_groups_courseusergroup` (`id`) CONSTRAINT `course_groups_cohortmem_user_id_15d408bf736398bf_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `course_groups_coursecohort`; DROP TABLE IF EXISTS `course_groups_coursecohort`;
...@@ -1031,12 +1056,12 @@ CREATE TABLE `course_modes_coursemode` ( ...@@ -1031,12 +1056,12 @@ CREATE TABLE `course_modes_coursemode` (
`mode_display_name` varchar(255) NOT NULL, `mode_display_name` varchar(255) NOT NULL,
`min_price` int(11) NOT NULL, `min_price` int(11) NOT NULL,
`currency` varchar(8) NOT NULL, `currency` varchar(8) NOT NULL,
`expiration_datetime` datetime(6) DEFAULT NULL,
`expiration_date` date DEFAULT NULL, `expiration_date` date DEFAULT NULL,
`suggested_prices` varchar(255) NOT NULL, `suggested_prices` varchar(255) NOT NULL,
`description` longtext, `description` longtext,
`sku` varchar(255) DEFAULT NULL, `sku` varchar(255) DEFAULT NULL,
`expiration_datetime_is_explicit` tinyint(1) NOT NULL, `expiration_datetime_is_explicit` tinyint(1) NOT NULL,
`expiration_datetime` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `course_modes_coursemode_course_id_6fbb1796ace558b4_uniq` (`course_id`,`mode_slug`,`currency`), UNIQUE KEY `course_modes_coursemode_course_id_6fbb1796ace558b4_uniq` (`course_id`,`mode_slug`,`currency`),
KEY `course_modes_coursemode_ea134da7` (`course_id`) KEY `course_modes_coursemode_ea134da7` (`course_id`)
...@@ -1515,8 +1540,8 @@ CREATE TABLE `django_admin_log` ( ...@@ -1515,8 +1540,8 @@ CREATE TABLE `django_admin_log` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `djang_content_type_id_697914295151027a_fk_django_content_type_id` (`content_type_id`), KEY `djang_content_type_id_697914295151027a_fk_django_content_type_id` (`content_type_id`),
KEY `django_admin_log_user_id_52fdd58701c5f563_fk_auth_user_id` (`user_id`), KEY `django_admin_log_user_id_52fdd58701c5f563_fk_auth_user_id` (`user_id`),
CONSTRAINT `django_admin_log_user_id_52fdd58701c5f563_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `djang_content_type_id_697914295151027a_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`),
CONSTRAINT `djang_content_type_id_697914295151027a_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) CONSTRAINT `django_admin_log_user_id_52fdd58701c5f563_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `django_comment_client_permission`; DROP TABLE IF EXISTS `django_comment_client_permission`;
...@@ -1537,8 +1562,8 @@ CREATE TABLE `django_comment_client_permission_roles` ( ...@@ -1537,8 +1562,8 @@ CREATE TABLE `django_comment_client_permission_roles` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `permission_id` (`permission_id`,`role_id`), UNIQUE KEY `permission_id` (`permission_id`,`role_id`),
KEY `django_role_id_558412c96ef7ba87_fk_django_comment_client_role_id` (`role_id`), KEY `django_role_id_558412c96ef7ba87_fk_django_comment_client_role_id` (`role_id`),
CONSTRAINT `django_role_id_558412c96ef7ba87_fk_django_comment_client_role_id` FOREIGN KEY (`role_id`) REFERENCES `django_comment_client_role` (`id`), CONSTRAINT `D4e9a4067c1db9041491363f5e032121` FOREIGN KEY (`permission_id`) REFERENCES `django_comment_client_permission` (`name`),
CONSTRAINT `D4e9a4067c1db9041491363f5e032121` FOREIGN KEY (`permission_id`) REFERENCES `django_comment_client_permission` (`name`) CONSTRAINT `django_role_id_558412c96ef7ba87_fk_django_comment_client_role_id` FOREIGN KEY (`role_id`) REFERENCES `django_comment_client_role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `django_comment_client_role`; DROP TABLE IF EXISTS `django_comment_client_role`;
...@@ -1575,7 +1600,7 @@ CREATE TABLE `django_content_type` ( ...@@ -1575,7 +1600,7 @@ CREATE TABLE `django_content_type` (
`model` varchar(100) NOT NULL, `model` varchar(100) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `django_content_type_app_label_45f3b1d93ec8c61c_uniq` (`app_label`,`model`) UNIQUE KEY `django_content_type_app_label_45f3b1d93ec8c61c_uniq` (`app_label`,`model`)
) ENGINE=InnoDB AUTO_INCREMENT=238 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=245 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `django_migrations`; DROP TABLE IF EXISTS `django_migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
...@@ -1586,7 +1611,7 @@ CREATE TABLE `django_migrations` ( ...@@ -1586,7 +1611,7 @@ CREATE TABLE `django_migrations` (
`name` varchar(255) NOT NULL, `name` varchar(255) NOT NULL,
`applied` datetime(6) NOT NULL, `applied` datetime(6) NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `django_openid_auth_association`; DROP TABLE IF EXISTS `django_openid_auth_association`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
...@@ -1694,8 +1719,8 @@ CREATE TABLE `djcelery_periodictask` ( ...@@ -1694,8 +1719,8 @@ CREATE TABLE `djcelery_periodictask` (
UNIQUE KEY `name` (`name`), UNIQUE KEY `name` (`name`),
KEY `djc_interval_id_20cfc1cad060dfad_fk_djcelery_intervalschedule_id` (`interval_id`), KEY `djc_interval_id_20cfc1cad060dfad_fk_djcelery_intervalschedule_id` (`interval_id`),
KEY `djcel_crontab_id_1d8228f5b44b680a_fk_djcelery_crontabschedule_id` (`crontab_id`), KEY `djcel_crontab_id_1d8228f5b44b680a_fk_djcelery_crontabschedule_id` (`crontab_id`),
CONSTRAINT `djcel_crontab_id_1d8228f5b44b680a_fk_djcelery_crontabschedule_id` FOREIGN KEY (`crontab_id`) REFERENCES `djcelery_crontabschedule` (`id`), CONSTRAINT `djc_interval_id_20cfc1cad060dfad_fk_djcelery_intervalschedule_id` FOREIGN KEY (`interval_id`) REFERENCES `djcelery_intervalschedule` (`id`),
CONSTRAINT `djc_interval_id_20cfc1cad060dfad_fk_djcelery_intervalschedule_id` FOREIGN KEY (`interval_id`) REFERENCES `djcelery_intervalschedule` (`id`) CONSTRAINT `djcel_crontab_id_1d8228f5b44b680a_fk_djcelery_crontabschedule_id` FOREIGN KEY (`crontab_id`) REFERENCES `djcelery_crontabschedule` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `djcelery_periodictasks`; DROP TABLE IF EXISTS `djcelery_periodictasks`;
...@@ -1776,8 +1801,8 @@ CREATE TABLE `edxval_encodedvideo` ( ...@@ -1776,8 +1801,8 @@ CREATE TABLE `edxval_encodedvideo` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `edxval_encodedvideo_83a0eb3f` (`profile_id`), KEY `edxval_encodedvideo_83a0eb3f` (`profile_id`),
KEY `edxval_encodedvideo_b58b747e` (`video_id`), KEY `edxval_encodedvideo_b58b747e` (`video_id`),
CONSTRAINT `edxval_encodedvideo_video_id_56934bca09fc3b13_fk_edxval_video_id` FOREIGN KEY (`video_id`) REFERENCES `edxval_video` (`id`), CONSTRAINT `edxval_encodedv_profile_id_484a111092acafb3_fk_edxval_profile_id` FOREIGN KEY (`profile_id`) REFERENCES `edxval_profile` (`id`),
CONSTRAINT `edxval_encodedv_profile_id_484a111092acafb3_fk_edxval_profile_id` FOREIGN KEY (`profile_id`) REFERENCES `edxval_profile` (`id`) CONSTRAINT `edxval_encodedvideo_video_id_56934bca09fc3b13_fk_edxval_video_id` FOREIGN KEY (`video_id`) REFERENCES `edxval_video` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `edxval_profile`; DROP TABLE IF EXISTS `edxval_profile`;
...@@ -1980,6 +2005,102 @@ CREATE TABLE `lms_xblock_xblockasidesconfig` ( ...@@ -1980,6 +2005,102 @@ CREATE TABLE `lms_xblock_xblockasidesconfig` (
CONSTRAINT `lms_xblock_xblocka_changed_by_id_eabf5ef3e34dfb8_fk_auth_user_id` FOREIGN KEY (`changed_by_id`) REFERENCES `auth_user` (`id`) CONSTRAINT `lms_xblock_xblocka_changed_by_id_eabf5ef3e34dfb8_fk_auth_user_id` FOREIGN KEY (`changed_by_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `microsite_configuration_historicalmicrositeorganizationmapping`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `microsite_configuration_historicalmicrositeorganizationmapping` (
`id` int(11) NOT NULL,
`organization` varchar(63) NOT NULL,
`history_id` int(11) NOT NULL AUTO_INCREMENT,
`history_date` datetime(6) NOT NULL,
`history_type` varchar(1) NOT NULL,
`history_user_id` int(11) DEFAULT NULL,
`microsite_id` int(11),
PRIMARY KEY (`history_id`),
KEY `microsite_confi_history_user_id_40846fe04877dd35_fk_auth_user_id` (`history_user_id`),
KEY `microsite_configuration_historicalmicrositeorganizationmappi1219` (`id`),
KEY `microsite_configuration_historicalmicrositeorganizationmappi74d9` (`organization`),
KEY `microsite_configuration_historicalmicrositeorganizationmappi5a96` (`microsite_id`),
CONSTRAINT `microsite_confi_history_user_id_40846fe04877dd35_fk_auth_user_id` FOREIGN KEY (`history_user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `microsite_configuration_historicalmicrositetemplate`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `microsite_configuration_historicalmicrositetemplate` (
`id` int(11) NOT NULL,
`template_uri` varchar(255) NOT NULL,
`template` longtext NOT NULL,
`history_id` int(11) NOT NULL AUTO_INCREMENT,
`history_date` datetime(6) NOT NULL,
`history_type` varchar(1) NOT NULL,
`history_user_id` int(11) DEFAULT NULL,
`microsite_id` int(11),
PRIMARY KEY (`history_id`),
KEY `microsite_confi_history_user_id_53e1b0dcb708d6ef_fk_auth_user_id` (`history_user_id`),
KEY `microsite_configuration_historicalmicrositetemplate_b80bb774` (`id`),
KEY `microsite_configuration_historicalmicrositetemplate_a8b249ec` (`template_uri`),
KEY `microsite_configuration_historicalmicrositetemplate_c9cd58ae` (`microsite_id`),
CONSTRAINT `microsite_confi_history_user_id_53e1b0dcb708d6ef_fk_auth_user_id` FOREIGN KEY (`history_user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `microsite_configuration_microsite`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `microsite_configuration_microsite` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(63) NOT NULL,
`values` longtext NOT NULL,
`site_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`),
UNIQUE KEY `site_id` (`site_id`),
CONSTRAINT `microsite_configuratio_site_id_3ebe20a76de5aa4_fk_django_site_id` FOREIGN KEY (`site_id`) REFERENCES `django_site` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `microsite_configuration_micrositehistory`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `microsite_configuration_micrositehistory` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created` datetime(6) NOT NULL,
`modified` datetime(6) NOT NULL,
`key` varchar(63) NOT NULL,
`values` longtext NOT NULL,
`site_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`),
UNIQUE KEY `site_id` (`site_id`),
CONSTRAINT `microsite_configurati_site_id_6977a04d3625a533_fk_django_site_id` FOREIGN KEY (`site_id`) REFERENCES `django_site` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `microsite_configuration_micrositeorganizationmapping`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `microsite_configuration_micrositeorganizationmapping` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`organization` varchar(63) NOT NULL,
`microsite_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `organization` (`organization`),
KEY `D1c5d7dbbb2cde12ce18b38d46f71ee0` (`microsite_id`),
CONSTRAINT `D1c5d7dbbb2cde12ce18b38d46f71ee0` FOREIGN KEY (`microsite_id`) REFERENCES `microsite_configuration_microsite` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `microsite_configuration_micrositetemplate`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `microsite_configuration_micrositetemplate` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`template_uri` varchar(255) NOT NULL,
`template` longtext NOT NULL,
`microsite_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `microsite_configuration_micros_microsite_id_80b3f3616d2e317_uniq` (`microsite_id`,`template_uri`),
KEY `microsite_configuration_micrositetemplate_a8b249ec` (`template_uri`),
CONSTRAINT `D4919cbc5f1414d3de93aa9ec9aa48f3` FOREIGN KEY (`microsite_id`) REFERENCES `microsite_configuration_microsite` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `milestones_coursecontentmilestone`; DROP TABLE IF EXISTS `milestones_coursecontentmilestone`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
...@@ -2165,8 +2286,8 @@ CREATE TABLE `notify_subscription` ( ...@@ -2165,8 +2286,8 @@ CREATE TABLE `notify_subscription` (
PRIMARY KEY (`subscription_id`), PRIMARY KEY (`subscription_id`),
KEY `a2462650bbefc26547210b80dec61069` (`notification_type_id`), KEY `a2462650bbefc26547210b80dec61069` (`notification_type_id`),
KEY `notify_subscr_settings_id_64d594d127e8ca95_fk_notify_settings_id` (`settings_id`), KEY `notify_subscr_settings_id_64d594d127e8ca95_fk_notify_settings_id` (`settings_id`),
CONSTRAINT `notify_subscr_settings_id_64d594d127e8ca95_fk_notify_settings_id` FOREIGN KEY (`settings_id`) REFERENCES `notify_settings` (`id`), CONSTRAINT `a2462650bbefc26547210b80dec61069` FOREIGN KEY (`notification_type_id`) REFERENCES `notify_notificationtype` (`key`),
CONSTRAINT `a2462650bbefc26547210b80dec61069` FOREIGN KEY (`notification_type_id`) REFERENCES `notify_notificationtype` (`key`) CONSTRAINT `notify_subscr_settings_id_64d594d127e8ca95_fk_notify_settings_id` FOREIGN KEY (`settings_id`) REFERENCES `notify_settings` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth2_accesstoken`; DROP TABLE IF EXISTS `oauth2_accesstoken`;
...@@ -2183,8 +2304,8 @@ CREATE TABLE `oauth2_accesstoken` ( ...@@ -2183,8 +2304,8 @@ CREATE TABLE `oauth2_accesstoken` (
KEY `oauth2_accesstoken_94a08da1` (`token`), KEY `oauth2_accesstoken_94a08da1` (`token`),
KEY `oauth2_accesstoken_2bfe9d72` (`client_id`), KEY `oauth2_accesstoken_2bfe9d72` (`client_id`),
KEY `oauth2_accesstoken_e8701ad4` (`user_id`), KEY `oauth2_accesstoken_e8701ad4` (`user_id`),
CONSTRAINT `oauth2_accesstoken_user_id_7a865c7085722378_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `oauth2_accesstoke_client_id_20c73b03a7c139a2_fk_oauth2_client_id` FOREIGN KEY (`client_id`) REFERENCES `oauth2_client` (`id`),
CONSTRAINT `oauth2_accesstoke_client_id_20c73b03a7c139a2_fk_oauth2_client_id` FOREIGN KEY (`client_id`) REFERENCES `oauth2_client` (`id`) CONSTRAINT `oauth2_accesstoken_user_id_7a865c7085722378_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth2_client`; DROP TABLE IF EXISTS `oauth2_client`;
...@@ -2218,8 +2339,8 @@ CREATE TABLE `oauth2_grant` ( ...@@ -2218,8 +2339,8 @@ CREATE TABLE `oauth2_grant` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `oauth2_grant_client_id_fbfc174fbc856af_fk_oauth2_client_id` (`client_id`), KEY `oauth2_grant_client_id_fbfc174fbc856af_fk_oauth2_client_id` (`client_id`),
KEY `oauth2_grant_user_id_3de96a461bb76819_fk_auth_user_id` (`user_id`), KEY `oauth2_grant_user_id_3de96a461bb76819_fk_auth_user_id` (`user_id`),
CONSTRAINT `oauth2_grant_user_id_3de96a461bb76819_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `oauth2_grant_client_id_fbfc174fbc856af_fk_oauth2_client_id` FOREIGN KEY (`client_id`) REFERENCES `oauth2_client` (`id`),
CONSTRAINT `oauth2_grant_client_id_fbfc174fbc856af_fk_oauth2_client_id` FOREIGN KEY (`client_id`) REFERENCES `oauth2_client` (`id`) CONSTRAINT `oauth2_grant_user_id_3de96a461bb76819_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth2_provider_trustedclient`; DROP TABLE IF EXISTS `oauth2_provider_trustedclient`;
...@@ -2247,9 +2368,9 @@ CREATE TABLE `oauth2_refreshtoken` ( ...@@ -2247,9 +2368,9 @@ CREATE TABLE `oauth2_refreshtoken` (
UNIQUE KEY `access_token_id` (`access_token_id`), UNIQUE KEY `access_token_id` (`access_token_id`),
KEY `oauth2_refreshtok_client_id_2f55036ac9aa614e_fk_oauth2_client_id` (`client_id`), KEY `oauth2_refreshtok_client_id_2f55036ac9aa614e_fk_oauth2_client_id` (`client_id`),
KEY `oauth2_refreshtoken_user_id_acecf94460b787c_fk_auth_user_id` (`user_id`), KEY `oauth2_refreshtoken_user_id_acecf94460b787c_fk_auth_user_id` (`user_id`),
CONSTRAINT `oauth2_refreshtoken_user_id_acecf94460b787c_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `oauth2__access_token_id_f99377d503a000b_fk_oauth2_accesstoken_id` FOREIGN KEY (`access_token_id`) REFERENCES `oauth2_accesstoken` (`id`),
CONSTRAINT `oauth2_refreshtok_client_id_2f55036ac9aa614e_fk_oauth2_client_id` FOREIGN KEY (`client_id`) REFERENCES `oauth2_client` (`id`), CONSTRAINT `oauth2_refreshtok_client_id_2f55036ac9aa614e_fk_oauth2_client_id` FOREIGN KEY (`client_id`) REFERENCES `oauth2_client` (`id`),
CONSTRAINT `oauth2__access_token_id_f99377d503a000b_fk_oauth2_accesstoken_id` FOREIGN KEY (`access_token_id`) REFERENCES `oauth2_accesstoken` (`id`) CONSTRAINT `oauth2_refreshtoken_user_id_acecf94460b787c_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth_provider_consumer`; DROP TABLE IF EXISTS `oauth_provider_consumer`;
...@@ -2313,9 +2434,9 @@ CREATE TABLE `oauth_provider_token` ( ...@@ -2313,9 +2434,9 @@ CREATE TABLE `oauth_provider_token` (
KEY `oauth_consumer_id_1b9915b5bcf1ee5b_fk_oauth_provider_consumer_id` (`consumer_id`), KEY `oauth_consumer_id_1b9915b5bcf1ee5b_fk_oauth_provider_consumer_id` (`consumer_id`),
KEY `oauth_provi_scope_id_459821b6fecbc02a_fk_oauth_provider_scope_id` (`scope_id`), KEY `oauth_provi_scope_id_459821b6fecbc02a_fk_oauth_provider_scope_id` (`scope_id`),
KEY `oauth_provider_token_user_id_588adbcffc892186_fk_auth_user_id` (`user_id`), KEY `oauth_provider_token_user_id_588adbcffc892186_fk_auth_user_id` (`user_id`),
CONSTRAINT `oauth_provider_token_user_id_588adbcffc892186_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `oauth_consumer_id_1b9915b5bcf1ee5b_fk_oauth_provider_consumer_id` FOREIGN KEY (`consumer_id`) REFERENCES `oauth_provider_consumer` (`id`), CONSTRAINT `oauth_consumer_id_1b9915b5bcf1ee5b_fk_oauth_provider_consumer_id` FOREIGN KEY (`consumer_id`) REFERENCES `oauth_provider_consumer` (`id`),
CONSTRAINT `oauth_provi_scope_id_459821b6fecbc02a_fk_oauth_provider_scope_id` FOREIGN KEY (`scope_id`) REFERENCES `oauth_provider_scope` (`id`) CONSTRAINT `oauth_provi_scope_id_459821b6fecbc02a_fk_oauth_provider_scope_id` FOREIGN KEY (`scope_id`) REFERENCES `oauth_provider_scope` (`id`),
CONSTRAINT `oauth_provider_token_user_id_588adbcffc892186_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `organizations_organization`; DROP TABLE IF EXISTS `organizations_organization`;
...@@ -2388,8 +2509,8 @@ CREATE TABLE `proctoring_proctoredexamreviewpolicy` ( ...@@ -2388,8 +2509,8 @@ CREATE TABLE `proctoring_proctoredexamreviewpolicy` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `D32bab97500954b362d3f768dd89b6da` (`proctored_exam_id`), KEY `D32bab97500954b362d3f768dd89b6da` (`proctored_exam_id`),
KEY `proctoring_proct_set_by_user_id_75a66580aa44cd84_fk_auth_user_id` (`set_by_user_id`), KEY `proctoring_proct_set_by_user_id_75a66580aa44cd84_fk_auth_user_id` (`set_by_user_id`),
CONSTRAINT `proctoring_proct_set_by_user_id_75a66580aa44cd84_fk_auth_user_id` FOREIGN KEY (`set_by_user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `D32bab97500954b362d3f768dd89b6da` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`),
CONSTRAINT `D32bab97500954b362d3f768dd89b6da` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`) CONSTRAINT `proctoring_proct_set_by_user_id_75a66580aa44cd84_fk_auth_user_id` FOREIGN KEY (`set_by_user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `proctoring_proctoredexamreviewpolicyhistory`; DROP TABLE IF EXISTS `proctoring_proctoredexamreviewpolicyhistory`;
...@@ -2407,8 +2528,8 @@ CREATE TABLE `proctoring_proctoredexamreviewpolicyhistory` ( ...@@ -2407,8 +2528,8 @@ CREATE TABLE `proctoring_proctoredexamreviewpolicyhistory` (
KEY `d9965d8af87bebd0587414ca1ba4826f` (`proctored_exam_id`), KEY `d9965d8af87bebd0587414ca1ba4826f` (`proctored_exam_id`),
KEY `proctoring_procto_set_by_user_id_31fae610848d90f_fk_auth_user_id` (`set_by_user_id`), KEY `proctoring_procto_set_by_user_id_31fae610848d90f_fk_auth_user_id` (`set_by_user_id`),
KEY `proctoring_proctoredexamreviewpolicyhistory_524b09d0` (`original_id`), KEY `proctoring_proctoredexamreviewpolicyhistory_524b09d0` (`original_id`),
CONSTRAINT `proctoring_procto_set_by_user_id_31fae610848d90f_fk_auth_user_id` FOREIGN KEY (`set_by_user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `d9965d8af87bebd0587414ca1ba4826f` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`),
CONSTRAINT `d9965d8af87bebd0587414ca1ba4826f` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`) CONSTRAINT `proctoring_procto_set_by_user_id_31fae610848d90f_fk_auth_user_id` FOREIGN KEY (`set_by_user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `proctoring_proctoredexamsoftwaresecurereview`; DROP TABLE IF EXISTS `proctoring_proctoredexamsoftwaresecurereview`;
...@@ -2430,9 +2551,9 @@ CREATE TABLE `proctoring_proctoredexamsoftwaresecurereview` ( ...@@ -2430,9 +2551,9 @@ CREATE TABLE `proctoring_proctoredexamsoftwaresecurereview` (
KEY `proctoring_proct_reviewed_by_id_4cff67b7de094f65_fk_auth_user_id` (`reviewed_by_id`), KEY `proctoring_proct_reviewed_by_id_4cff67b7de094f65_fk_auth_user_id` (`reviewed_by_id`),
KEY `proctoring_proctored_student_id_14c182517b0cbb5b_fk_auth_user_id` (`student_id`), KEY `proctoring_proctored_student_id_14c182517b0cbb5b_fk_auth_user_id` (`student_id`),
KEY `proctoring_proctoredexamsoftwaresecurereview_b38e5b0e` (`attempt_code`), KEY `proctoring_proctoredexamsoftwaresecurereview_b38e5b0e` (`attempt_code`),
CONSTRAINT `proctoring_proctored_student_id_14c182517b0cbb5b_fk_auth_user_id` FOREIGN KEY (`student_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `proctori_exam_id_635059f5fe2cc392_fk_proctoring_proctoredexam_id` FOREIGN KEY (`exam_id`) REFERENCES `proctoring_proctoredexam` (`id`),
CONSTRAINT `proctoring_proct_reviewed_by_id_4cff67b7de094f65_fk_auth_user_id` FOREIGN KEY (`reviewed_by_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `proctoring_proct_reviewed_by_id_4cff67b7de094f65_fk_auth_user_id` FOREIGN KEY (`reviewed_by_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `proctori_exam_id_635059f5fe2cc392_fk_proctoring_proctoredexam_id` FOREIGN KEY (`exam_id`) REFERENCES `proctoring_proctoredexam` (`id`) CONSTRAINT `proctoring_proctored_student_id_14c182517b0cbb5b_fk_auth_user_id` FOREIGN KEY (`student_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `proctoring_proctoredexamsoftwaresecurereviewhistory`; DROP TABLE IF EXISTS `proctoring_proctoredexamsoftwaresecurereviewhistory`;
...@@ -2454,9 +2575,9 @@ CREATE TABLE `proctoring_proctoredexamsoftwaresecurereviewhistory` ( ...@@ -2454,9 +2575,9 @@ CREATE TABLE `proctoring_proctoredexamsoftwaresecurereviewhistory` (
KEY `proctoring_proct_reviewed_by_id_139568d0bf423998_fk_auth_user_id` (`reviewed_by_id`), KEY `proctoring_proct_reviewed_by_id_139568d0bf423998_fk_auth_user_id` (`reviewed_by_id`),
KEY `proctoring_proctored_student_id_6922ba3b791462d8_fk_auth_user_id` (`student_id`), KEY `proctoring_proctored_student_id_6922ba3b791462d8_fk_auth_user_id` (`student_id`),
KEY `proctoring_proctoredexamsoftwaresecurereviewhistory_b38e5b0e` (`attempt_code`), KEY `proctoring_proctoredexamsoftwaresecurereviewhistory_b38e5b0e` (`attempt_code`),
CONSTRAINT `proctoring_proctored_student_id_6922ba3b791462d8_fk_auth_user_id` FOREIGN KEY (`student_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `proctori_exam_id_73969ae423813477_fk_proctoring_proctoredexam_id` FOREIGN KEY (`exam_id`) REFERENCES `proctoring_proctoredexam` (`id`),
CONSTRAINT `proctoring_proct_reviewed_by_id_139568d0bf423998_fk_auth_user_id` FOREIGN KEY (`reviewed_by_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `proctoring_proct_reviewed_by_id_139568d0bf423998_fk_auth_user_id` FOREIGN KEY (`reviewed_by_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `proctori_exam_id_73969ae423813477_fk_proctoring_proctoredexam_id` FOREIGN KEY (`exam_id`) REFERENCES `proctoring_proctoredexam` (`id`) CONSTRAINT `proctoring_proctored_student_id_6922ba3b791462d8_fk_auth_user_id` FOREIGN KEY (`student_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `proctoring_proctoredexamstudentallowance`; DROP TABLE IF EXISTS `proctoring_proctoredexamstudentallowance`;
...@@ -2473,8 +2594,8 @@ CREATE TABLE `proctoring_proctoredexamstudentallowance` ( ...@@ -2473,8 +2594,8 @@ CREATE TABLE `proctoring_proctoredexamstudentallowance` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `proctoring_proctoredexamstudentall_user_id_665ed945152c2f60_uniq` (`user_id`,`proctored_exam_id`,`key`), UNIQUE KEY `proctoring_proctoredexamstudentall_user_id_665ed945152c2f60_uniq` (`user_id`,`proctored_exam_id`,`key`),
KEY `db55b83a7875e70b3a0ebd1f81a898d8` (`proctored_exam_id`), KEY `db55b83a7875e70b3a0ebd1f81a898d8` (`proctored_exam_id`),
CONSTRAINT `proctoring_proctoredexam_user_id_a0a0681d4a01661_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `db55b83a7875e70b3a0ebd1f81a898d8` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`),
CONSTRAINT `db55b83a7875e70b3a0ebd1f81a898d8` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`) CONSTRAINT `proctoring_proctoredexam_user_id_a0a0681d4a01661_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `proctoring_proctoredexamstudentallowancehistory`; DROP TABLE IF EXISTS `proctoring_proctoredexamstudentallowancehistory`;
...@@ -2492,8 +2613,8 @@ CREATE TABLE `proctoring_proctoredexamstudentallowancehistory` ( ...@@ -2492,8 +2613,8 @@ CREATE TABLE `proctoring_proctoredexamstudentallowancehistory` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `D169ec97a7fca1dbf6b0bb2929d41ccc` (`proctored_exam_id`), KEY `D169ec97a7fca1dbf6b0bb2929d41ccc` (`proctored_exam_id`),
KEY `proctoring_proctoredexa_user_id_68e25e3abb187580_fk_auth_user_id` (`user_id`), KEY `proctoring_proctoredexa_user_id_68e25e3abb187580_fk_auth_user_id` (`user_id`),
CONSTRAINT `proctoring_proctoredexa_user_id_68e25e3abb187580_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `D169ec97a7fca1dbf6b0bb2929d41ccc` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`),
CONSTRAINT `D169ec97a7fca1dbf6b0bb2929d41ccc` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`) CONSTRAINT `proctoring_proctoredexa_user_id_68e25e3abb187580_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `proctoring_proctoredexamstudentattempt`; DROP TABLE IF EXISTS `proctoring_proctoredexamstudentattempt`;
...@@ -2572,8 +2693,8 @@ CREATE TABLE `proctoring_proctoredexamstudentattempthistory` ( ...@@ -2572,8 +2693,8 @@ CREATE TABLE `proctoring_proctoredexamstudentattempthistory` (
KEY `proctoring_proctoredexa_user_id_59ce75db7c4fc769_fk_auth_user_id` (`user_id`), KEY `proctoring_proctoredexa_user_id_59ce75db7c4fc769_fk_auth_user_id` (`user_id`),
KEY `proctoring_proctoredexamstudentattempthistory_b38e5b0e` (`attempt_code`), KEY `proctoring_proctoredexamstudentattempthistory_b38e5b0e` (`attempt_code`),
KEY `proctoring_proctoredexamstudentattempthistory_0e684294` (`external_id`), KEY `proctoring_proctoredexamstudentattempthistory_0e684294` (`external_id`),
CONSTRAINT `proctoring_proctoredexa_user_id_59ce75db7c4fc769_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `cbccbfd5c4c427541fdce96e77e6bf6c` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`),
CONSTRAINT `cbccbfd5c4c427541fdce96e77e6bf6c` FOREIGN KEY (`proctored_exam_id`) REFERENCES `proctoring_proctoredexam` (`id`) CONSTRAINT `proctoring_proctoredexa_user_id_59ce75db7c4fc769_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `programs_programsapiconfig`; DROP TABLE IF EXISTS `programs_programsapiconfig`;
...@@ -2658,9 +2779,9 @@ CREATE TABLE `shoppingcart_couponredemption` ( ...@@ -2658,9 +2779,9 @@ CREATE TABLE `shoppingcart_couponredemption` (
KEY `shoppingcar_coupon_id_1afa016627ac44bb_fk_shoppingcart_coupon_id` (`coupon_id`), KEY `shoppingcar_coupon_id_1afa016627ac44bb_fk_shoppingcart_coupon_id` (`coupon_id`),
KEY `shoppingcart_couponredemption_69dfcb07` (`order_id`), KEY `shoppingcart_couponredemption_69dfcb07` (`order_id`),
KEY `shoppingcart_couponredemption_e8701ad4` (`user_id`), KEY `shoppingcart_couponredemption_e8701ad4` (`user_id`),
CONSTRAINT `shoppingcart_couponredemp_user_id_f5b814b7d92666_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `shoppingcar_coupon_id_1afa016627ac44bb_fk_shoppingcart_coupon_id` FOREIGN KEY (`coupon_id`) REFERENCES `shoppingcart_coupon` (`id`),
CONSTRAINT `shoppingcart__order_id_5ba031c3bfaf643a_fk_shoppingcart_order_id` FOREIGN KEY (`order_id`) REFERENCES `shoppingcart_order` (`id`), CONSTRAINT `shoppingcart__order_id_5ba031c3bfaf643a_fk_shoppingcart_order_id` FOREIGN KEY (`order_id`) REFERENCES `shoppingcart_order` (`id`),
CONSTRAINT `shoppingcar_coupon_id_1afa016627ac44bb_fk_shoppingcart_coupon_id` FOREIGN KEY (`coupon_id`) REFERENCES `shoppingcart_coupon` (`id`) CONSTRAINT `shoppingcart_couponredemp_user_id_f5b814b7d92666_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `shoppingcart_courseregcodeitem`; DROP TABLE IF EXISTS `shoppingcart_courseregcodeitem`;
...@@ -2709,9 +2830,9 @@ CREATE TABLE `shoppingcart_courseregistrationcode` ( ...@@ -2709,9 +2830,9 @@ CREATE TABLE `shoppingcart_courseregistrationcode` (
KEY `shoppingcart_courseregistrationcode_69dfcb07` (`order_id`), KEY `shoppingcart_courseregistrationcode_69dfcb07` (`order_id`),
KEY `shoppingcart_courseregistrationcode_7a471658` (`invoice_item_id`), KEY `shoppingcart_courseregistrationcode_7a471658` (`invoice_item_id`),
CONSTRAINT `f040030b6361304bd87eb40c09a82094` FOREIGN KEY (`invoice_item_id`) REFERENCES `shoppingcart_courseregistrationcodeinvoiceitem` (`invoiceitem_ptr_id`), CONSTRAINT `f040030b6361304bd87eb40c09a82094` FOREIGN KEY (`invoice_item_id`) REFERENCES `shoppingcart_courseregistrationcodeinvoiceitem` (`invoiceitem_ptr_id`),
CONSTRAINT `shoppingcart_cour_created_by_id_11125a9667aa01c9_fk_auth_user_id` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `shoppingc_invoice_id_422f26bdc7c5cb99_fk_shoppingcart_invoice_id` FOREIGN KEY (`invoice_id`) REFERENCES `shoppingcart_invoice` (`id`),
CONSTRAINT `shoppingcart__order_id_279d7e2df3fe6b6a_fk_shoppingcart_order_id` FOREIGN KEY (`order_id`) REFERENCES `shoppingcart_order` (`id`), CONSTRAINT `shoppingcart__order_id_279d7e2df3fe6b6a_fk_shoppingcart_order_id` FOREIGN KEY (`order_id`) REFERENCES `shoppingcart_order` (`id`),
CONSTRAINT `shoppingc_invoice_id_422f26bdc7c5cb99_fk_shoppingcart_invoice_id` FOREIGN KEY (`invoice_id`) REFERENCES `shoppingcart_invoice` (`id`) CONSTRAINT `shoppingcart_cour_created_by_id_11125a9667aa01c9_fk_auth_user_id` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `shoppingcart_courseregistrationcodeinvoiceitem`; DROP TABLE IF EXISTS `shoppingcart_courseregistrationcodeinvoiceitem`;
...@@ -2827,9 +2948,9 @@ CREATE TABLE `shoppingcart_invoicetransaction` ( ...@@ -2827,9 +2948,9 @@ CREATE TABLE `shoppingcart_invoicetransaction` (
KEY `shoppingcart_invoi_created_by_id_f5f3d90ce55a145_fk_auth_user_id` (`created_by_id`), KEY `shoppingcart_invoi_created_by_id_f5f3d90ce55a145_fk_auth_user_id` (`created_by_id`),
KEY `shoppingc_invoice_id_66bdbfa6f029288b_fk_shoppingcart_invoice_id` (`invoice_id`), KEY `shoppingc_invoice_id_66bdbfa6f029288b_fk_shoppingcart_invoice_id` (`invoice_id`),
KEY `shoppingcar_last_modified_by_id_5e10e433f9576d91_fk_auth_user_id` (`last_modified_by_id`), KEY `shoppingcar_last_modified_by_id_5e10e433f9576d91_fk_auth_user_id` (`last_modified_by_id`),
CONSTRAINT `shoppingc_invoice_id_66bdbfa6f029288b_fk_shoppingcart_invoice_id` FOREIGN KEY (`invoice_id`) REFERENCES `shoppingcart_invoice` (`id`),
CONSTRAINT `shoppingcar_last_modified_by_id_5e10e433f9576d91_fk_auth_user_id` FOREIGN KEY (`last_modified_by_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `shoppingcar_last_modified_by_id_5e10e433f9576d91_fk_auth_user_id` FOREIGN KEY (`last_modified_by_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `shoppingcart_invoi_created_by_id_f5f3d90ce55a145_fk_auth_user_id` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `shoppingcart_invoi_created_by_id_f5f3d90ce55a145_fk_auth_user_id` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`)
CONSTRAINT `shoppingc_invoice_id_66bdbfa6f029288b_fk_shoppingcart_invoice_id` FOREIGN KEY (`invoice_id`) REFERENCES `shoppingcart_invoice` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `shoppingcart_order`; DROP TABLE IF EXISTS `shoppingcart_order`;
...@@ -2890,8 +3011,8 @@ CREATE TABLE `shoppingcart_orderitem` ( ...@@ -2890,8 +3011,8 @@ CREATE TABLE `shoppingcart_orderitem` (
KEY `shoppingcart_orderitem_76ed2946` (`refund_requested_time`), KEY `shoppingcart_orderitem_76ed2946` (`refund_requested_time`),
KEY `shoppingcart_orderitem_69dfcb07` (`order_id`), KEY `shoppingcart_orderitem_69dfcb07` (`order_id`),
KEY `shoppingcart_orderitem_e8701ad4` (`user_id`), KEY `shoppingcart_orderitem_e8701ad4` (`user_id`),
CONSTRAINT `shoppingcart_orderitem_user_id_5708ec7aabe24a31_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `shoppingcart__order_id_325e5347f18743e3_fk_shoppingcart_order_id` FOREIGN KEY (`order_id`) REFERENCES `shoppingcart_order` (`id`),
CONSTRAINT `shoppingcart__order_id_325e5347f18743e3_fk_shoppingcart_order_id` FOREIGN KEY (`order_id`) REFERENCES `shoppingcart_order` (`id`) CONSTRAINT `shoppingcart_orderitem_user_id_5708ec7aabe24a31_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `shoppingcart_paidcourseregistration`; DROP TABLE IF EXISTS `shoppingcart_paidcourseregistration`;
...@@ -2938,8 +3059,8 @@ CREATE TABLE `shoppingcart_registrationcoderedemption` ( ...@@ -2938,8 +3059,8 @@ CREATE TABLE `shoppingcart_registrationcoderedemption` (
KEY `D1ed44c4be114e424571929bce972f54` (`registration_code_id`), KEY `D1ed44c4be114e424571929bce972f54` (`registration_code_id`),
CONSTRAINT `D1ed44c4be114e424571929bce972f54` FOREIGN KEY (`registration_code_id`) REFERENCES `shoppingcart_courseregistrationcode` (`id`), CONSTRAINT `D1ed44c4be114e424571929bce972f54` FOREIGN KEY (`registration_code_id`) REFERENCES `shoppingcart_courseregistrationcode` (`id`),
CONSTRAINT `D6654a8efe686d45804b6116dfc6bee1` FOREIGN KEY (`course_enrollment_id`) REFERENCES `student_courseenrollment` (`id`), CONSTRAINT `D6654a8efe686d45804b6116dfc6bee1` FOREIGN KEY (`course_enrollment_id`) REFERENCES `student_courseenrollment` (`id`),
CONSTRAINT `shoppingcart_reg_redeemed_by_id_455df2dd74004fff_fk_auth_user_id` FOREIGN KEY (`redeemed_by_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `shoppingcart_r_order_id_752ddc3003afe96_fk_shoppingcart_order_id` FOREIGN KEY (`order_id`) REFERENCES `shoppingcart_order` (`id`),
CONSTRAINT `shoppingcart_r_order_id_752ddc3003afe96_fk_shoppingcart_order_id` FOREIGN KEY (`order_id`) REFERENCES `shoppingcart_order` (`id`) CONSTRAINT `shoppingcart_reg_redeemed_by_id_455df2dd74004fff_fk_auth_user_id` FOREIGN KEY (`redeemed_by_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `social_auth_association`; DROP TABLE IF EXISTS `social_auth_association`;
...@@ -3330,8 +3451,8 @@ CREATE TABLE `student_userstanding` ( ...@@ -3330,8 +3451,8 @@ CREATE TABLE `student_userstanding` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`), UNIQUE KEY `user_id` (`user_id`),
KEY `student_userstand_changed_by_id_23784b83f2849aff_fk_auth_user_id` (`changed_by_id`), KEY `student_userstand_changed_by_id_23784b83f2849aff_fk_auth_user_id` (`changed_by_id`),
CONSTRAINT `student_userstanding_user_id_6bb90abaaa05d42e_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `student_userstand_changed_by_id_23784b83f2849aff_fk_auth_user_id` FOREIGN KEY (`changed_by_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `student_userstand_changed_by_id_23784b83f2849aff_fk_auth_user_id` FOREIGN KEY (`changed_by_id`) REFERENCES `auth_user` (`id`) CONSTRAINT `student_userstanding_user_id_6bb90abaaa05d42e_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `student_usertestgroup`; DROP TABLE IF EXISTS `student_usertestgroup`;
...@@ -3355,8 +3476,8 @@ CREATE TABLE `student_usertestgroup_users` ( ...@@ -3355,8 +3476,8 @@ CREATE TABLE `student_usertestgroup_users` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `usertestgroup_id` (`usertestgroup_id`,`user_id`), UNIQUE KEY `usertestgroup_id` (`usertestgroup_id`,`user_id`),
KEY `student_usertestgroup_u_user_id_26c886de60cceacb_fk_auth_user_id` (`user_id`), KEY `student_usertestgroup_u_user_id_26c886de60cceacb_fk_auth_user_id` (`user_id`),
CONSTRAINT `student_usertestgroup_u_user_id_26c886de60cceacb_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `st_usertestgroup_id_3d634741f1dd4e4f_fk_student_usertestgroup_id` FOREIGN KEY (`usertestgroup_id`) REFERENCES `student_usertestgroup` (`id`),
CONSTRAINT `st_usertestgroup_id_3d634741f1dd4e4f_fk_student_usertestgroup_id` FOREIGN KEY (`usertestgroup_id`) REFERENCES `student_usertestgroup` (`id`) CONSTRAINT `student_usertestgroup_u_user_id_26c886de60cceacb_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `submissions_score`; DROP TABLE IF EXISTS `submissions_score`;
...@@ -3374,8 +3495,8 @@ CREATE TABLE `submissions_score` ( ...@@ -3374,8 +3495,8 @@ CREATE TABLE `submissions_score` (
KEY `submissions_score_fde81f11` (`created_at`), KEY `submissions_score_fde81f11` (`created_at`),
KEY `submissions_score_02d5e83e` (`student_item_id`), KEY `submissions_score_02d5e83e` (`student_item_id`),
KEY `submissions_score_1dd9cfcc` (`submission_id`), KEY `submissions_score_1dd9cfcc` (`submission_id`),
CONSTRAINT `subm_submission_id_3fc975fe88442ff7_fk_submissions_submission_id` FOREIGN KEY (`submission_id`) REFERENCES `submissions_submission` (`id`), CONSTRAINT `s_student_item_id_7d4d4bb6a7dd0642_fk_submissions_studentitem_id` FOREIGN KEY (`student_item_id`) REFERENCES `submissions_studentitem` (`id`),
CONSTRAINT `s_student_item_id_7d4d4bb6a7dd0642_fk_submissions_studentitem_id` FOREIGN KEY (`student_item_id`) REFERENCES `submissions_studentitem` (`id`) CONSTRAINT `subm_submission_id_3fc975fe88442ff7_fk_submissions_submission_id` FOREIGN KEY (`submission_id`) REFERENCES `submissions_submission` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `submissions_scoreannotation`; DROP TABLE IF EXISTS `submissions_scoreannotation`;
...@@ -3407,8 +3528,8 @@ CREATE TABLE `submissions_scoresummary` ( ...@@ -3407,8 +3528,8 @@ CREATE TABLE `submissions_scoresummary` (
KEY `submissions__highest_id_7fd91b8eb312c175_fk_submissions_score_id` (`highest_id`), KEY `submissions__highest_id_7fd91b8eb312c175_fk_submissions_score_id` (`highest_id`),
KEY `submissions_s_latest_id_2b352506a35fd569_fk_submissions_score_id` (`latest_id`), KEY `submissions_s_latest_id_2b352506a35fd569_fk_submissions_score_id` (`latest_id`),
CONSTRAINT `s_student_item_id_32fa0a425a149b1b_fk_submissions_studentitem_id` FOREIGN KEY (`student_item_id`) REFERENCES `submissions_studentitem` (`id`), CONSTRAINT `s_student_item_id_32fa0a425a149b1b_fk_submissions_studentitem_id` FOREIGN KEY (`student_item_id`) REFERENCES `submissions_studentitem` (`id`),
CONSTRAINT `submissions_s_latest_id_2b352506a35fd569_fk_submissions_score_id` FOREIGN KEY (`latest_id`) REFERENCES `submissions_score` (`id`), CONSTRAINT `submissions__highest_id_7fd91b8eb312c175_fk_submissions_score_id` FOREIGN KEY (`highest_id`) REFERENCES `submissions_score` (`id`),
CONSTRAINT `submissions__highest_id_7fd91b8eb312c175_fk_submissions_score_id` FOREIGN KEY (`highest_id`) REFERENCES `submissions_score` (`id`) CONSTRAINT `submissions_s_latest_id_2b352506a35fd569_fk_submissions_score_id` FOREIGN KEY (`latest_id`) REFERENCES `submissions_score` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `submissions_studentitem`; DROP TABLE IF EXISTS `submissions_studentitem`;
...@@ -3463,8 +3584,8 @@ CREATE TABLE `survey_surveyanswer` ( ...@@ -3463,8 +3584,8 @@ CREATE TABLE `survey_surveyanswer` (
KEY `survey_surveyanswer_c8235886` (`course_key`), KEY `survey_surveyanswer_c8235886` (`course_key`),
KEY `survey_surveyanswer_d6cba1ad` (`form_id`), KEY `survey_surveyanswer_d6cba1ad` (`form_id`),
KEY `survey_surveyanswer_e8701ad4` (`user_id`), KEY `survey_surveyanswer_e8701ad4` (`user_id`),
CONSTRAINT `survey_surveyanswer_user_id_4e77d83a82fd0b2b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `survey_surveyan_form_id_1c835afe12a54912_fk_survey_surveyform_id` FOREIGN KEY (`form_id`) REFERENCES `survey_surveyform` (`id`),
CONSTRAINT `survey_surveyan_form_id_1c835afe12a54912_fk_survey_surveyform_id` FOREIGN KEY (`form_id`) REFERENCES `survey_surveyform` (`id`) CONSTRAINT `survey_surveyanswer_user_id_4e77d83a82fd0b2b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `survey_surveyform`; DROP TABLE IF EXISTS `survey_surveyform`;
...@@ -3518,8 +3639,8 @@ CREATE TABLE `teams_courseteammembership` ( ...@@ -3518,8 +3639,8 @@ CREATE TABLE `teams_courseteammembership` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `teams_courseteammembership_user_id_48efa8e8971947c3_uniq` (`user_id`,`team_id`), UNIQUE KEY `teams_courseteammembership_user_id_48efa8e8971947c3_uniq` (`user_id`,`team_id`),
KEY `teams_courseteam_team_id_594700d19b04f922_fk_teams_courseteam_id` (`team_id`), KEY `teams_courseteam_team_id_594700d19b04f922_fk_teams_courseteam_id` (`team_id`),
CONSTRAINT `teams_courseteammembers_user_id_2d93b28be22c3c40_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `teams_courseteam_team_id_594700d19b04f922_fk_teams_courseteam_id` FOREIGN KEY (`team_id`) REFERENCES `teams_courseteam` (`id`),
CONSTRAINT `teams_courseteam_team_id_594700d19b04f922_fk_teams_courseteam_id` FOREIGN KEY (`team_id`) REFERENCES `teams_courseteam` (`id`) CONSTRAINT `teams_courseteammembers_user_id_2d93b28be22c3c40_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `third_party_auth_ltiproviderconfig`; DROP TABLE IF EXISTS `third_party_auth_ltiproviderconfig`;
...@@ -3793,8 +3914,8 @@ CREATE TABLE `verify_student_skippedreverification` ( ...@@ -3793,8 +3914,8 @@ CREATE TABLE `verify_student_skippedreverification` (
KEY `verify_student_skippedreverification_ea134da7` (`course_id`), KEY `verify_student_skippedreverification_ea134da7` (`course_id`),
KEY `verify_student_skippedreverification_bef2d98a` (`checkpoint_id`), KEY `verify_student_skippedreverification_bef2d98a` (`checkpoint_id`),
KEY `verify_student_skippedreverification_e8701ad4` (`user_id`), KEY `verify_student_skippedreverification_e8701ad4` (`user_id`),
CONSTRAINT `verify_student_skippedr_user_id_6752b392e3d3c501_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `D759ffa5ca66ef1a2c8c200f7a21365b` FOREIGN KEY (`checkpoint_id`) REFERENCES `verify_student_verificationcheckpoint` (`id`),
CONSTRAINT `D759ffa5ca66ef1a2c8c200f7a21365b` FOREIGN KEY (`checkpoint_id`) REFERENCES `verify_student_verificationcheckpoint` (`id`) CONSTRAINT `verify_student_skippedr_user_id_6752b392e3d3c501_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `verify_student_softwaresecurephotoverification`; DROP TABLE IF EXISTS `verify_student_softwaresecurephotoverification`;
...@@ -3828,9 +3949,9 @@ CREATE TABLE `verify_student_softwaresecurephotoverification` ( ...@@ -3828,9 +3949,9 @@ CREATE TABLE `verify_student_softwaresecurephotoverification` (
KEY `verify_student_softwaresecurephotoverification_afd1a1a8` (`updated_at`), KEY `verify_student_softwaresecurephotoverification_afd1a1a8` (`updated_at`),
KEY `verify_student_softwaresecurephotoverification_ebf78b51` (`display`), KEY `verify_student_softwaresecurephotoverification_ebf78b51` (`display`),
KEY `verify_student_softwaresecurephotoverification_22bb6ff9` (`submitted_at`), KEY `verify_student_softwaresecurephotoverification_22bb6ff9` (`submitted_at`),
CONSTRAINT `verify_student_software_user_id_61ffab9c12020106_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `D01dce17b91c9382bd80d4be23a3e0cf` FOREIGN KEY (`copy_id_photo_from_id`) REFERENCES `verify_student_softwaresecurephotoverification` (`id`), CONSTRAINT `D01dce17b91c9382bd80d4be23a3e0cf` FOREIGN KEY (`copy_id_photo_from_id`) REFERENCES `verify_student_softwaresecurephotoverification` (`id`),
CONSTRAINT `verify_studen_reviewing_user_id_727fae1d0bcf8aaf_fk_auth_user_id` FOREIGN KEY (`reviewing_user_id`) REFERENCES `auth_user` (`id`) CONSTRAINT `verify_studen_reviewing_user_id_727fae1d0bcf8aaf_fk_auth_user_id` FOREIGN KEY (`reviewing_user_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `verify_student_software_user_id_61ffab9c12020106_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `verify_student_verificationcheckpoint`; DROP TABLE IF EXISTS `verify_student_verificationcheckpoint`;
...@@ -3888,8 +4009,8 @@ CREATE TABLE `verify_student_verificationstatus` ( ...@@ -3888,8 +4009,8 @@ CREATE TABLE `verify_student_verificationstatus` (
KEY `D4cefb6d3d71c9b26af2a5ece4c37277` (`checkpoint_id`), KEY `D4cefb6d3d71c9b26af2a5ece4c37277` (`checkpoint_id`),
KEY `verify_student_verifica_user_id_5c19fcd6dc05f211_fk_auth_user_id` (`user_id`), KEY `verify_student_verifica_user_id_5c19fcd6dc05f211_fk_auth_user_id` (`user_id`),
KEY `verify_student_verificationstatus_9acb4454` (`status`), KEY `verify_student_verificationstatus_9acb4454` (`status`),
CONSTRAINT `verify_student_verifica_user_id_5c19fcd6dc05f211_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), CONSTRAINT `D4cefb6d3d71c9b26af2a5ece4c37277` FOREIGN KEY (`checkpoint_id`) REFERENCES `verify_student_verificationcheckpoint` (`id`),
CONSTRAINT `D4cefb6d3d71c9b26af2a5ece4c37277` FOREIGN KEY (`checkpoint_id`) REFERENCES `verify_student_verificationcheckpoint` (`id`) CONSTRAINT `verify_student_verifica_user_id_5c19fcd6dc05f211_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `wiki_article`; DROP TABLE IF EXISTS `wiki_article`;
...@@ -3910,9 +4031,9 @@ CREATE TABLE `wiki_article` ( ...@@ -3910,9 +4031,9 @@ CREATE TABLE `wiki_article` (
UNIQUE KEY `current_revision_id` (`current_revision_id`), UNIQUE KEY `current_revision_id` (`current_revision_id`),
KEY `wiki_article_0e939a4f` (`group_id`), KEY `wiki_article_0e939a4f` (`group_id`),
KEY `wiki_article_5e7b1936` (`owner_id`), KEY `wiki_article_5e7b1936` (`owner_id`),
CONSTRAINT `wiki_article_owner_id_b1c1e44609a378f_fk_auth_user_id` FOREIGN KEY (`owner_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `current_revision_id_42a9dbec1e0dd15c_fk_wiki_articlerevision_id` FOREIGN KEY (`current_revision_id`) REFERENCES `wiki_articlerevision` (`id`), CONSTRAINT `current_revision_id_42a9dbec1e0dd15c_fk_wiki_articlerevision_id` FOREIGN KEY (`current_revision_id`) REFERENCES `wiki_articlerevision` (`id`),
CONSTRAINT `wiki_article_group_id_2b38601b6aa39f3d_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) CONSTRAINT `wiki_article_group_id_2b38601b6aa39f3d_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`),
CONSTRAINT `wiki_article_owner_id_b1c1e44609a378f_fk_auth_user_id` FOREIGN KEY (`owner_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `wiki_articleforobject`; DROP TABLE IF EXISTS `wiki_articleforobject`;
...@@ -3966,9 +4087,9 @@ CREATE TABLE `wiki_articlerevision` ( ...@@ -3966,9 +4087,9 @@ CREATE TABLE `wiki_articlerevision` (
UNIQUE KEY `wiki_articlerevision_article_id_4b4e7910c8e7b2d0_uniq` (`article_id`,`revision_number`), UNIQUE KEY `wiki_articlerevision_article_id_4b4e7910c8e7b2d0_uniq` (`article_id`,`revision_number`),
KEY `fae2b1c6e892c699844d5dda69aeb89e` (`previous_revision_id`), KEY `fae2b1c6e892c699844d5dda69aeb89e` (`previous_revision_id`),
KEY `wiki_articlerevision_user_id_183520686b6ead55_fk_auth_user_id` (`user_id`), KEY `wiki_articlerevision_user_id_183520686b6ead55_fk_auth_user_id` (`user_id`),
CONSTRAINT `wiki_articlerevision_user_id_183520686b6ead55_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `fae2b1c6e892c699844d5dda69aeb89e` FOREIGN KEY (`previous_revision_id`) REFERENCES `wiki_articlerevision` (`id`), CONSTRAINT `fae2b1c6e892c699844d5dda69aeb89e` FOREIGN KEY (`previous_revision_id`) REFERENCES `wiki_articlerevision` (`id`),
CONSTRAINT `wiki_articlerevis_article_id_1f2c587981af1463_fk_wiki_article_id` FOREIGN KEY (`article_id`) REFERENCES `wiki_article` (`id`) CONSTRAINT `wiki_articlerevis_article_id_1f2c587981af1463_fk_wiki_article_id` FOREIGN KEY (`article_id`) REFERENCES `wiki_article` (`id`),
CONSTRAINT `wiki_articlerevision_user_id_183520686b6ead55_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `wiki_attachment`; DROP TABLE IF EXISTS `wiki_attachment`;
...@@ -4006,9 +4127,9 @@ CREATE TABLE `wiki_attachmentrevision` ( ...@@ -4006,9 +4127,9 @@ CREATE TABLE `wiki_attachmentrevision` (
KEY `wiki_attachmentrevision_07ba63f5` (`attachment_id`), KEY `wiki_attachmentrevision_07ba63f5` (`attachment_id`),
KEY `wiki_attachmentrevision_e8680b8a` (`previous_revision_id`), KEY `wiki_attachmentrevision_e8680b8a` (`previous_revision_id`),
KEY `wiki_attachmentrevision_e8701ad4` (`user_id`), KEY `wiki_attachmentrevision_e8701ad4` (`user_id`),
CONSTRAINT `wiki_attachmentrevision_user_id_427e3f452b4bfdcd_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `D68d5cd540b66f536228137e518081f8` FOREIGN KEY (`attachment_id`) REFERENCES `wiki_attachment` (`reusableplugin_ptr_id`), CONSTRAINT `D68d5cd540b66f536228137e518081f8` FOREIGN KEY (`attachment_id`) REFERENCES `wiki_attachment` (`reusableplugin_ptr_id`),
CONSTRAINT `D8c1f0a8f0ddceb9c3ebc94379fe22c9` FOREIGN KEY (`previous_revision_id`) REFERENCES `wiki_attachmentrevision` (`id`) CONSTRAINT `D8c1f0a8f0ddceb9c3ebc94379fe22c9` FOREIGN KEY (`previous_revision_id`) REFERENCES `wiki_attachmentrevision` (`id`),
CONSTRAINT `wiki_attachmentrevision_user_id_427e3f452b4bfdcd_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `wiki_image`; DROP TABLE IF EXISTS `wiki_image`;
...@@ -4051,8 +4172,8 @@ CREATE TABLE `wiki_reusableplugin_articles` ( ...@@ -4051,8 +4172,8 @@ CREATE TABLE `wiki_reusableplugin_articles` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `reusableplugin_id` (`reusableplugin_id`,`article_id`), UNIQUE KEY `reusableplugin_id` (`reusableplugin_id`,`article_id`),
KEY `wiki_reusableplug_article_id_5e893d3b3fb4f7fa_fk_wiki_article_id` (`article_id`), KEY `wiki_reusableplug_article_id_5e893d3b3fb4f7fa_fk_wiki_article_id` (`article_id`),
CONSTRAINT `wiki_reusableplug_article_id_5e893d3b3fb4f7fa_fk_wiki_article_id` FOREIGN KEY (`article_id`) REFERENCES `wiki_article` (`id`), CONSTRAINT `a9f9f50fd4e8fdafe7ffc0c1a145fee3` FOREIGN KEY (`reusableplugin_id`) REFERENCES `wiki_reusableplugin` (`articleplugin_ptr_id`),
CONSTRAINT `a9f9f50fd4e8fdafe7ffc0c1a145fee3` FOREIGN KEY (`reusableplugin_id`) REFERENCES `wiki_reusableplugin` (`articleplugin_ptr_id`) CONSTRAINT `wiki_reusableplug_article_id_5e893d3b3fb4f7fa_fk_wiki_article_id` FOREIGN KEY (`article_id`) REFERENCES `wiki_article` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `wiki_revisionplugin`; DROP TABLE IF EXISTS `wiki_revisionplugin`;
...@@ -4087,9 +4208,9 @@ CREATE TABLE `wiki_revisionpluginrevision` ( ...@@ -4087,9 +4208,9 @@ CREATE TABLE `wiki_revisionpluginrevision` (
KEY `wiki_revisionpluginrevision_b25eaab4` (`plugin_id`), KEY `wiki_revisionpluginrevision_b25eaab4` (`plugin_id`),
KEY `wiki_revisionpluginrevision_e8680b8a` (`previous_revision_id`), KEY `wiki_revisionpluginrevision_e8680b8a` (`previous_revision_id`),
KEY `wiki_revisionpluginrevision_e8701ad4` (`user_id`), KEY `wiki_revisionpluginrevision_e8701ad4` (`user_id`),
CONSTRAINT `wiki_revisionpluginrevi_user_id_55a00bd0e2532762_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`),
CONSTRAINT `D9574e2f57b828a85a24838761473871` FOREIGN KEY (`plugin_id`) REFERENCES `wiki_revisionplugin` (`articleplugin_ptr_id`), CONSTRAINT `D9574e2f57b828a85a24838761473871` FOREIGN KEY (`plugin_id`) REFERENCES `wiki_revisionplugin` (`articleplugin_ptr_id`),
CONSTRAINT `e524c4f887e857f93c39356f7cf7d4df` FOREIGN KEY (`previous_revision_id`) REFERENCES `wiki_revisionpluginrevision` (`id`) CONSTRAINT `e524c4f887e857f93c39356f7cf7d4df` FOREIGN KEY (`previous_revision_id`) REFERENCES `wiki_revisionpluginrevision` (`id`),
CONSTRAINT `wiki_revisionpluginrevi_user_id_55a00bd0e2532762_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `wiki_simpleplugin`; DROP TABLE IF EXISTS `wiki_simpleplugin`;
...@@ -4126,9 +4247,9 @@ CREATE TABLE `wiki_urlpath` ( ...@@ -4126,9 +4247,9 @@ CREATE TABLE `wiki_urlpath` (
KEY `wiki_urlpath_656442a0` (`tree_id`), KEY `wiki_urlpath_656442a0` (`tree_id`),
KEY `wiki_urlpath_c9e9a848` (`level`), KEY `wiki_urlpath_c9e9a848` (`level`),
KEY `wiki_urlpath_6be37982` (`parent_id`), KEY `wiki_urlpath_6be37982` (`parent_id`),
CONSTRAINT `wiki_urlpath_site_id_4f30e731b0464e80_fk_django_site_id` FOREIGN KEY (`site_id`) REFERENCES `django_site` (`id`),
CONSTRAINT `wiki_urlpath_article_id_1d1c5eb9a64e1390_fk_wiki_article_id` FOREIGN KEY (`article_id`) REFERENCES `wiki_article` (`id`), CONSTRAINT `wiki_urlpath_article_id_1d1c5eb9a64e1390_fk_wiki_article_id` FOREIGN KEY (`article_id`) REFERENCES `wiki_article` (`id`),
CONSTRAINT `wiki_urlpath_parent_id_24eab80cd168595f_fk_wiki_urlpath_id` FOREIGN KEY (`parent_id`) REFERENCES `wiki_urlpath` (`id`) CONSTRAINT `wiki_urlpath_parent_id_24eab80cd168595f_fk_wiki_urlpath_id` FOREIGN KEY (`parent_id`) REFERENCES `wiki_urlpath` (`id`),
CONSTRAINT `wiki_urlpath_site_id_4f30e731b0464e80_fk_django_site_id` FOREIGN KEY (`site_id`) REFERENCES `django_site` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `workflow_assessmentworkflow`; DROP TABLE IF EXISTS `workflow_assessmentworkflow`;
......
...@@ -78,7 +78,7 @@ def get_certificates_for_user(username): ...@@ -78,7 +78,7 @@ def get_certificates_for_user(username):
else None else None
), ),
} }
for cert in GeneratedCertificate.eligible_certificates.filter(user__username=username).order_by("course_id") for cert in GeneratedCertificate.objects.filter(user__username=username).order_by("course_id")
] ]
...@@ -109,14 +109,11 @@ def generate_user_certificates(student, course_key, course=None, insecure=False, ...@@ -109,14 +109,11 @@ def generate_user_certificates(student, course_key, course=None, insecure=False,
if insecure: if insecure:
xqueue.use_https = False xqueue.use_https = False
generate_pdf = not has_html_certificates_enabled(course_key, course) generate_pdf = not has_html_certificates_enabled(course_key, course)
cert = xqueue.add_cert( status, cert = xqueue.add_cert(student, course_key,
student, course=course,
course_key, generate_pdf=generate_pdf,
course=course, forced_grade=forced_grade)
generate_pdf=generate_pdf, if status in [CertificateStatuses.generating, CertificateStatuses.downloadable]:
forced_grade=forced_grade
)
if cert.status in [CertificateStatuses.generating, CertificateStatuses.downloadable]:
emit_certificate_event('created', student, course_key, course, { emit_certificate_event('created', student, course_key, course, {
'user_id': student.id, 'user_id': student.id,
'course_id': unicode(course_key), 'course_id': unicode(course_key),
...@@ -124,7 +121,7 @@ def generate_user_certificates(student, course_key, course=None, insecure=False, ...@@ -124,7 +121,7 @@ def generate_user_certificates(student, course_key, course=None, insecure=False,
'enrollment_mode': cert.mode, 'enrollment_mode': cert.mode,
'generation_mode': generation_mode 'generation_mode': generation_mode
}) })
return cert.status return status
def regenerate_user_certificates(student, course_key, course=None, def regenerate_user_certificates(student, course_key, course=None,
...@@ -388,7 +385,7 @@ def get_certificate_url(user_id=None, course_id=None, uuid=None): ...@@ -388,7 +385,7 @@ def get_certificate_url(user_id=None, course_id=None, uuid=None):
) )
return url return url
try: try:
user_certificate = GeneratedCertificate.eligible_certificates.get( user_certificate = GeneratedCertificate.objects.get(
user=user_id, user=user_id,
course_id=course_id course_id=course_id
) )
......
...@@ -76,7 +76,7 @@ class Command(BaseCommand): ...@@ -76,7 +76,7 @@ class Command(BaseCommand):
status = options.get('status', CertificateStatuses.downloadable) status = options.get('status', CertificateStatuses.downloadable)
grade = options.get('grade', '') grade = options.get('grade', '')
cert, created = GeneratedCertificate.eligible_certificates.get_or_create( cert, created = GeneratedCertificate.objects.get_or_create(
user=user, user=user,
course_id=course_key course_id=course_key
) )
......
...@@ -42,9 +42,8 @@ class Command(BaseCommand): ...@@ -42,9 +42,8 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
course_id = options['course'] course_id = options['course']
print "Fetching ungraded students for {0}".format(course_id) print "Fetching ungraded students for {0}".format(course_id)
ungraded = GeneratedCertificate.objects.filter( # pylint: disable=no-member ungraded = GeneratedCertificate.objects.filter(
course_id__exact=course_id course_id__exact=course_id).filter(grade__exact='')
).filter(grade__exact='')
course = courses.get_course_by_id(course_id) course = courses.get_course_by_id(course_id)
factory = RequestFactory() factory = RequestFactory()
request = factory.get('/') request = factory.get('/')
......
...@@ -70,17 +70,14 @@ class Command(BaseCommand): ...@@ -70,17 +70,14 @@ class Command(BaseCommand):
enrolled_total = User.objects.filter( enrolled_total = User.objects.filter(
courseenrollment__course_id=course_id courseenrollment__course_id=course_id
) )
verified_enrolled = GeneratedCertificate.objects.filter( # pylint: disable=no-member verified_enrolled = GeneratedCertificate.objects.filter(
course_id__exact=course_id, course_id__exact=course_id, mode__exact='verified'
mode__exact='verified'
) )
honor_enrolled = GeneratedCertificate.objects.filter( # pylint: disable=no-member honor_enrolled = GeneratedCertificate.objects.filter(
course_id__exact=course_id, course_id__exact=course_id, mode__exact='honor'
mode__exact='honor'
) )
audit_enrolled = GeneratedCertificate.objects.filter( # pylint: disable=no-member audit_enrolled = GeneratedCertificate.objects.filter(
course_id__exact=course_id, course_id__exact=course_id, mode__exact='audit'
mode__exact='audit'
) )
cert_data[course_id] = { cert_data[course_id] = {
...@@ -91,7 +88,7 @@ class Command(BaseCommand): ...@@ -91,7 +88,7 @@ class Command(BaseCommand):
'audit_enrolled': audit_enrolled.count() 'audit_enrolled': audit_enrolled.count()
} }
status_tally = GeneratedCertificate.objects.filter( # pylint: disable=no-member status_tally = GeneratedCertificate.objects.filter(
course_id__exact=course_id course_id__exact=course_id
).values('status').annotate( ).values('status').annotate(
dcount=Count('status') dcount=Count('status')
...@@ -103,7 +100,7 @@ class Command(BaseCommand): ...@@ -103,7 +100,7 @@ class Command(BaseCommand):
} }
) )
mode_tally = GeneratedCertificate.objects.filter( # pylint: disable=no-member mode_tally = GeneratedCertificate.objects.filter(
course_id__exact=course_id, course_id__exact=course_id,
status__exact='downloadable' status__exact='downloadable'
).values('mode').annotate( ).values('mode').annotate(
......
...@@ -81,7 +81,7 @@ class Command(BaseCommand): ...@@ -81,7 +81,7 @@ class Command(BaseCommand):
# Retrieve the IDs of generated certificates with # Retrieve the IDs of generated certificates with
# error status in the set of courses we're considering. # error status in the set of courses we're considering.
queryset = ( queryset = (
GeneratedCertificate.objects.select_related('user') # pylint: disable=no-member GeneratedCertificate.objects.select_related('user')
).filter(status=CertificateStatuses.error) ).filter(status=CertificateStatuses.error)
if only_course_keys: if only_course_keys:
queryset = queryset.filter(course_id__in=only_course_keys) queryset = queryset.filter(course_id__in=only_course_keys)
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('certificates', '0007_certificateinvalidation'),
]
operations = [
migrations.AddField(
model_name='generatedcertificate',
name='eligible_for_certificate',
field=models.BooleanField(default=True),
),
]
...@@ -143,7 +143,7 @@ class CertificateWhitelist(models.Model): ...@@ -143,7 +143,7 @@ class CertificateWhitelist(models.Model):
if student: if student:
white_list = white_list.filter(user=student) white_list = white_list.filter(user=student)
result = [] result = []
generated_certificates = GeneratedCertificate.eligible_certificates.filter( generated_certificates = GeneratedCertificate.objects.filter(
course_id=course_id, course_id=course_id,
user__in=[exception.user for exception in white_list], user__in=[exception.user for exception in white_list],
status=CertificateStatuses.downloadable status=CertificateStatuses.downloadable
...@@ -168,40 +168,11 @@ class CertificateWhitelist(models.Model): ...@@ -168,40 +168,11 @@ class CertificateWhitelist(models.Model):
return result return result
class EligibleCertificateManager(models.Manager):
"""
A manager for `GeneratedCertificate` models that automatically
filters out ineligible certs.
The idea is to prevent accidentally granting certificates to
students who have not enrolled in a cert-granting mode. The
alternative is to filter by eligible_for_certificate=True every
time certs are searched for, which is verbose and likely to be
forgotten.
"""
def get_queryset(self):
"""
Return a queryset for `GeneratedCertificate` models, filtering out
ineligible certificates.
"""
return super(EligibleCertificateManager, self).get_queryset().filter(eligible_for_certificate=True)
class GeneratedCertificate(models.Model): class GeneratedCertificate(models.Model):
""" """
Base model for generated certificates Base model for generated certificates
""" """
# Only returns eligible certificates. This should be used in
# preference to the default `objects` manager in most cases.
eligible_certificates = EligibleCertificateManager()
# Normal object manager, which should only be used when ineligible
# certificates (i.e. new audit certs) should be included in the
# results. Django requires us to explicitly declare this.
objects = models.Manager()
MODES = Choices('verified', 'honor', 'audit', 'professional', 'no-id-professional') MODES = Choices('verified', 'honor', 'audit', 'professional', 'no-id-professional')
VERIFIED_CERTS_MODES = [CourseMode.VERIFIED, CourseMode.CREDIT_MODE] VERIFIED_CERTS_MODES = [CourseMode.VERIFIED, CourseMode.CREDIT_MODE]
...@@ -220,19 +191,6 @@ class GeneratedCertificate(models.Model): ...@@ -220,19 +191,6 @@ class GeneratedCertificate(models.Model):
created_date = models.DateTimeField(auto_now_add=True) created_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now=True) modified_date = models.DateTimeField(auto_now=True)
error_reason = models.CharField(max_length=512, blank=True, default='') error_reason = models.CharField(max_length=512, blank=True, default='')
# Whether or not this GeneratedCertificate represents a
# certificate which can be shown to the user. Grading and
# certificate logic is intertwined here, so even enrollments
# without certificates (as of Jan 2016, this is only audit mode)
# create a GeneratedCertificate record to record the learner's
# final grade. Since audit enrollments used to have certificates
# and now do not, we need to be able to distinguish between old
# records and new in our analytics and reporting. The way we'll do
# this is by checking this field. By default it is True in order
# to make sure old records are counted correctly, and in
# `GeneratedCertificate.add_cert` we set it to False for new audit
# enrollments.
eligible_for_certificate = models.BooleanField(default=True)
class Meta(object): class Meta(object):
unique_together = (('user', 'course_id'),) unique_together = (('user', 'course_id'),)
...@@ -452,7 +410,7 @@ def certificate_status_for_student(student, course_id): ...@@ -452,7 +410,7 @@ def certificate_status_for_student(student, course_id):
''' '''
try: try:
generated_certificate = GeneratedCertificate.objects.get( # pylint: disable=no-member generated_certificate = GeneratedCertificate.objects.get(
user=student, course_id=course_id) user=student, course_id=course_id)
cert_status = { cert_status = {
'status': generated_certificate.status, 'status': generated_certificate.status,
......
...@@ -20,7 +20,6 @@ from student.models import UserProfile, CourseEnrollment ...@@ -20,7 +20,6 @@ from student.models import UserProfile, CourseEnrollment
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
from certificates.models import ( from certificates.models import (
CertificateStatuses,
GeneratedCertificate, GeneratedCertificate,
certificate_status_for_student, certificate_status_for_student,
CertificateStatuses as status, CertificateStatuses as status,
...@@ -121,14 +120,14 @@ class XQueueCertInterface(object): ...@@ -121,14 +120,14 @@ class XQueueCertInterface(object):
Change the certificate status to unavailable (if it exists) and request Change the certificate status to unavailable (if it exists) and request
grading. Passing grades will put a certificate request on the queue. grading. Passing grades will put a certificate request on the queue.
Return the certificate. Return the status object.
""" """
# TODO: when del_cert is implemented and plumbed through certificates # TODO: when del_cert is implemented and plumbed through certificates
# repo also, do a deletion followed by a creation r/t a simple # repo also, do a deletion followed by a creation r/t a simple
# recreation. XXX: this leaves orphan cert files laying around in # recreation. XXX: this leaves orphan cert files laying around in
# AWS. See note in the docstring too. # AWS. See note in the docstring too.
try: try:
certificate = GeneratedCertificate.eligible_certificates.get(user=student, course_id=course_id) certificate = GeneratedCertificate.objects.get(user=student, course_id=course_id)
LOGGER.info( LOGGER.info(
( (
...@@ -184,7 +183,8 @@ class XQueueCertInterface(object): ...@@ -184,7 +183,8 @@ class XQueueCertInterface(object):
raise NotImplementedError raise NotImplementedError
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
def add_cert(self, student, course_id, course=None, forced_grade=None, template_file=None, generate_pdf=True): def add_cert(self, student, course_id, course=None, forced_grade=None, template_file=None,
title='None', generate_pdf=True):
""" """
Request a new certificate for a student. Request a new certificate for a student.
...@@ -211,7 +211,7 @@ class XQueueCertInterface(object): ...@@ -211,7 +211,7 @@ class XQueueCertInterface(object):
If a student does not have a passing grade the status If a student does not have a passing grade the status
will change to status.notpassing will change to status.notpassing
Returns the newly created certificate instance Returns the student's status and newly created certificate instance
""" """
valid_statuses = [ valid_statuses = [
...@@ -225,6 +225,7 @@ class XQueueCertInterface(object): ...@@ -225,6 +225,7 @@ class XQueueCertInterface(object):
] ]
cert_status = certificate_status_for_student(student, course_id)['status'] cert_status = certificate_status_for_student(student, course_id)['status']
new_status = cert_status
cert = None cert = None
if cert_status not in valid_statuses: if cert_status not in valid_statuses:
...@@ -239,99 +240,155 @@ class XQueueCertInterface(object): ...@@ -239,99 +240,155 @@ class XQueueCertInterface(object):
cert_status, cert_status,
unicode(valid_statuses) unicode(valid_statuses)
) )
return None
# The caller can optionally pass a course in to avoid
# re-fetching it from Mongo. If they have not provided one,
# get it from the modulestore.
if course is None:
course = modulestore().get_course(course_id, depth=0)
profile = UserProfile.objects.get(user=student)
profile_name = profile.name
# Needed for access control in grading.
self.request.user = student
self.request.session = {}
is_whitelisted = self.whitelist.filter(user=student, course_id=course_id, whitelist=True).exists()
grade = grades.grade(student, self.request, course)
enrollment_mode, __ = CourseEnrollment.enrollment_mode_for_user(student, course_id)
mode_is_verified = enrollment_mode in GeneratedCertificate.VERIFIED_CERTS_MODES
user_is_verified = SoftwareSecurePhotoVerification.user_is_verified(student)
cert_mode = enrollment_mode
is_eligible_for_certificate = is_whitelisted or CourseMode.is_eligible_for_certificate(enrollment_mode)
# For credit mode generate verified certificate
if cert_mode == CourseMode.CREDIT_MODE:
cert_mode = CourseMode.VERIFIED
if template_file is not None:
template_pdf = template_file
elif mode_is_verified and user_is_verified:
template_pdf = "certificate-template-{id.org}-{id.course}-verified.pdf".format(id=course_id)
elif mode_is_verified and not user_is_verified:
template_pdf = "certificate-template-{id.org}-{id.course}.pdf".format(id=course_id)
cert_mode = GeneratedCertificate.MODES.honor
else: else:
# honor code and audit students # grade the student
template_pdf = "certificate-template-{id.org}-{id.course}.pdf".format(id=course_id)
if forced_grade: # re-use the course passed in optionally so we don't have to re-fetch everything
grade['grade'] = forced_grade # for every student
if course is None:
cert, created = GeneratedCertificate.eligible_certificates.get_or_create(user=student, course_id=course_id) course = modulestore().get_course(course_id, depth=0)
profile = UserProfile.objects.get(user=student)
cert.mode = cert_mode profile_name = profile.name
cert.user = student
cert.grade = grade['percent'] # Needed
cert.course_id = course_id self.request.user = student
cert.name = profile_name self.request.session = {}
cert.download_url = ''
course_name = course.display_name or unicode(course_id)
# If this user's enrollment is not eligible to receive a is_whitelisted = self.whitelist.filter(user=student, course_id=course_id, whitelist=True).exists()
# certificate, mark it as such for reporting and grade = grades.grade(student, self.request, course)
# analytics. Only do this if the certificate is new -- we enrollment_mode, __ = CourseEnrollment.enrollment_mode_for_user(student, course_id)
# don't want to mark existing audit certs as ineligible. mode_is_verified = enrollment_mode in GeneratedCertificate.VERIFIED_CERTS_MODES
if created and not is_eligible_for_certificate: user_is_verified = SoftwareSecurePhotoVerification.user_is_verified(student)
cert.eligible_for_certificate = False cert_mode = enrollment_mode
cert.status = CertificateStatuses.auditing
cert.save() # For credit mode generate verified certificate
LOGGER.info( if cert_mode == CourseMode.CREDIT_MODE:
u"Student %s with enrollment mode %s is not eligible for a certificate.", cert_mode = CourseMode.VERIFIED
student.id,
enrollment_mode if mode_is_verified and user_is_verified:
) template_pdf = "certificate-template-{id.org}-{id.course}-verified.pdf".format(id=course_id)
return cert elif mode_is_verified and not user_is_verified:
template_pdf = "certificate-template-{id.org}-{id.course}.pdf".format(id=course_id)
# Strip HTML from grade range label cert_mode = GeneratedCertificate.MODES.honor
grade_contents = grade.get('grade', None) else:
try: # honor code and audit students
grade_contents = lxml.html.fromstring(grade_contents).text_content() template_pdf = "certificate-template-{id.org}-{id.course}.pdf".format(id=course_id)
except (TypeError, XMLSyntaxError, ParserError) as exc: if forced_grade:
LOGGER.info( grade['grade'] = forced_grade
(
u"Could not retrieve grade for student %s " cert, __ = GeneratedCertificate.objects.get_or_create(user=student, course_id=course_id)
u"in the course '%s' "
u"because an exception occurred while parsing the " cert.mode = cert_mode
u"grade contents '%s' as HTML. " cert.user = student
u"The exception was: '%s'" cert.grade = grade['percent']
), cert.course_id = course_id
student.id, cert.name = profile_name
unicode(course_id), cert.download_url = ''
grade_contents, # Strip HTML from grade range label
unicode(exc) grade_contents = grade.get('grade', None)
) try:
grade_contents = lxml.html.fromstring(grade_contents).text_content()
# Log if the student is whitelisted except (TypeError, XMLSyntaxError, ParserError) as exc:
if is_whitelisted:
LOGGER.info( LOGGER.info(
u"Student %s is whitelisted in '%s'", (
u"Could not retrieve grade for student %s "
u"in the course '%s' "
u"because an exception occurred while parsing the "
u"grade contents '%s' as HTML. "
u"The exception was: '%s'"
),
student.id, student.id,
unicode(course_id) unicode(course_id),
grade_contents,
unicode(exc)
) )
# If they are not, short-circuit and don't generate cert
# Despite blowing up the xml parser, bad values here are fine
grade_contents = None
if is_whitelisted or grade_contents is not None:
if is_whitelisted:
LOGGER.info(
u"Student %s is whitelisted in '%s'",
student.id,
unicode(course_id)
)
# check to see whether the student is on the
# the embargoed country restricted list
# otherwise, put a new certificate request
# on the queue
if self.restricted.filter(user=student).exists():
new_status = status.restricted
cert.status = new_status
cert.save()
LOGGER.info(
(
u"Student %s is in the embargoed country restricted "
u"list, so their certificate status has been set to '%s' "
u"for the course '%s'. "
u"No certificate generation task was sent to the XQueue."
),
student.id,
new_status,
unicode(course_id)
)
else:
key = make_hashkey(random.random())
cert.key = key
contents = {
'action': 'create',
'username': student.username,
'course_id': unicode(course_id),
'course_name': course_name,
'name': profile_name,
'grade': grade_contents,
'template_pdf': template_pdf,
}
if template_file:
contents['template_pdf'] = template_file
if generate_pdf:
new_status = status.generating
else:
new_status = status.downloadable
cert.verify_uuid = uuid4().hex
cert.status = new_status
cert.save()
if generate_pdf:
try:
self._send_to_xqueue(contents, key)
except XQueueAddToQueueError as exc:
new_status = ExampleCertificate.STATUS_ERROR
cert.status = new_status
cert.error_reason = unicode(exc)
cert.save()
LOGGER.critical(
(
u"Could not add certificate task to XQueue. "
u"The course was '%s' and the student was '%s'."
u"The certificate task status has been marked as 'error' "
u"and can be re-submitted with a management command."
), course_id, student.id
)
else:
LOGGER.info(
(
u"The certificate status has been set to '%s'. "
u"Sent a certificate grading task to the XQueue "
u"with the key '%s'. "
),
new_status,
key
)
else: else:
cert.status = status.notpassing new_status = status.notpassing
cert.status = new_status
cert.save() cert.save()
LOGGER.info( LOGGER.info(
...@@ -342,85 +399,10 @@ class XQueueCertInterface(object): ...@@ -342,85 +399,10 @@ class XQueueCertInterface(object):
), ),
student.id, student.id,
unicode(course_id), unicode(course_id),
cert.status new_status
) )
return cert
# Check to see whether the student is on the the embargoed
# country restricted list. If so, they should not receive a
# certificate -- set their status to restricted and log it.
if self.restricted.filter(user=student).exists():
cert.status = status.restricted
cert.save()
LOGGER.info(
(
u"Student %s is in the embargoed country restricted "
u"list, so their certificate status has been set to '%s' "
u"for the course '%s'. "
u"No certificate generation task was sent to the XQueue."
),
student.id,
cert.status,
unicode(course_id)
)
return cert
# Finally, generate the certificate and send it off.
return self._generate_cert(cert, course, student, grade_contents, template_pdf, generate_pdf)
def _generate_cert(self, cert, course, student, grade_contents, template_pdf, generate_pdf):
"""
Generate a certificate for the student. If `generate_pdf` is True,
sends a request to XQueue.
"""
course_id = unicode(course.id)
key = make_hashkey(random.random())
cert.key = key
contents = {
'action': 'create',
'username': student.username,
'course_id': course_id,
'course_name': course.display_name or course_id,
'name': cert.name,
'grade': grade_contents,
'template_pdf': template_pdf,
}
if generate_pdf:
cert.status = status.generating
else:
cert.status = status.downloadable
cert.verify_uuid = uuid4().hex
cert.save()
if generate_pdf: return new_status, cert
try:
self._send_to_xqueue(contents, key)
except XQueueAddToQueueError as exc:
cert.status = ExampleCertificate.STATUS_ERROR
cert.error_reason = unicode(exc)
cert.save()
LOGGER.critical(
(
u"Could not add certificate task to XQueue. "
u"The course was '%s' and the student was '%s'."
u"The certificate task status has been marked as 'error' "
u"and can be re-submitted with a management command."
), course_id, student.id
)
else:
LOGGER.info(
(
u"The certificate status has been set to '%s'. "
u"Sent a certificate grading task to the XQueue "
u"with the key '%s'. "
),
cert.status,
key
)
return cert
def add_example_cert(self, example_cert): def add_example_cert(self, example_cert):
"""Add a task to create an example certificate. """Add a task to create an example certificate.
......
...@@ -231,7 +231,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu ...@@ -231,7 +231,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu
certs_api.generate_user_certificates(self.student, self.course.id) certs_api.generate_user_certificates(self.student, self.course.id)
# Verify that the certificate has status 'generating' # Verify that the certificate has status 'generating'
cert = GeneratedCertificate.eligible_certificates.get(user=self.student, course_id=self.course.id) cert = GeneratedCertificate.objects.get(user=self.student, course_id=self.course.id)
self.assertEqual(cert.status, CertificateStatuses.generating) self.assertEqual(cert.status, CertificateStatuses.generating)
self.assert_event_emitted( self.assert_event_emitted(
'edx.certificate.created', 'edx.certificate.created',
...@@ -249,7 +249,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu ...@@ -249,7 +249,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu
certs_api.generate_user_certificates(self.student, self.course.id) certs_api.generate_user_certificates(self.student, self.course.id)
# Verify that the certificate has been marked with status error # Verify that the certificate has been marked with status error
cert = GeneratedCertificate.eligible_certificates.get(user=self.student, course_id=self.course.id) cert = GeneratedCertificate.objects.get(user=self.student, course_id=self.course.id)
self.assertEqual(cert.status, 'error') self.assertEqual(cert.status, 'error')
self.assertIn(self.ERROR_REASON, cert.error_reason) self.assertIn(self.ERROR_REASON, cert.error_reason)
...@@ -263,7 +263,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu ...@@ -263,7 +263,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu
certs_api.generate_user_certificates(self.student, self.course.id) certs_api.generate_user_certificates(self.student, self.course.id)
# Verify that the certificate has status 'downloadable' # Verify that the certificate has status 'downloadable'
cert = GeneratedCertificate.eligible_certificates.get(user=self.student, course_id=self.course.id) cert = GeneratedCertificate.objects.get(user=self.student, course_id=self.course.id)
self.assertEqual(cert.status, CertificateStatuses.downloadable) self.assertEqual(cert.status, CertificateStatuses.downloadable)
@patch.dict(settings.FEATURES, {'CERTIFICATES_HTML_VIEW': False}) @patch.dict(settings.FEATURES, {'CERTIFICATES_HTML_VIEW': False})
......
...@@ -6,7 +6,6 @@ from nose.plugins.attrib import attr ...@@ -6,7 +6,6 @@ from nose.plugins.attrib import attr
from django.test.utils import override_settings from django.test.utils import override_settings
from mock import patch from mock import patch
from course_modes.models import CourseMode
from opaque_keys.edx.locator import CourseLocator from opaque_keys.edx.locator import CourseLocator
from certificates.tests.factories import BadgeAssertionFactory from certificates.tests.factories import BadgeAssertionFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...@@ -31,17 +30,16 @@ class CertificateManagementTest(ModuleStoreTestCase): ...@@ -31,17 +30,16 @@ class CertificateManagementTest(ModuleStoreTestCase):
for __ in range(3) for __ in range(3)
] ]
def _create_cert(self, course_key, user, status, mode=CourseMode.HONOR): def _create_cert(self, course_key, user, status):
"""Create a certificate entry. """ """Create a certificate entry. """
# Enroll the user in the course # Enroll the user in the course
CourseEnrollmentFactory.create( CourseEnrollmentFactory.create(
user=user, user=user,
course_id=course_key, course_id=course_key
mode=mode
) )
# Create the certificate # Create the certificate
GeneratedCertificate.eligible_certificates.create( GeneratedCertificate.objects.create(
user=user, user=user,
course_id=course_key, course_id=course_key,
status=status status=status
...@@ -54,7 +52,7 @@ class CertificateManagementTest(ModuleStoreTestCase): ...@@ -54,7 +52,7 @@ class CertificateManagementTest(ModuleStoreTestCase):
def _assert_cert_status(self, course_key, user, expected_status): def _assert_cert_status(self, course_key, user, expected_status):
"""Check the status of a certificate. """ """Check the status of a certificate. """
cert = GeneratedCertificate.eligible_certificates.get(user=user, course_id=course_key) cert = GeneratedCertificate.objects.get(user=user, course_id=course_key)
self.assertEqual(cert.status, expected_status) self.assertEqual(cert.status, expected_status)
...@@ -63,10 +61,9 @@ class CertificateManagementTest(ModuleStoreTestCase): ...@@ -63,10 +61,9 @@ class CertificateManagementTest(ModuleStoreTestCase):
class ResubmitErrorCertificatesTest(CertificateManagementTest): class ResubmitErrorCertificatesTest(CertificateManagementTest):
"""Tests for the resubmit_error_certificates management command. """ """Tests for the resubmit_error_certificates management command. """
@ddt.data(CourseMode.HONOR, CourseMode.VERIFIED) def test_resubmit_error_certificate(self):
def test_resubmit_error_certificate(self, mode):
# Create a certificate with status 'error' # Create a certificate with status 'error'
self._create_cert(self.courses[0].id, self.user, CertificateStatuses.error, mode) self._create_cert(self.courses[0].id, self.user, CertificateStatuses.error)
# Re-submit all certificates with status 'error' # Re-submit all certificates with status 'error'
with check_mongo_calls(1): with check_mongo_calls(1):
...@@ -201,7 +198,7 @@ class RegenerateCertificatesTest(CertificateManagementTest): ...@@ -201,7 +198,7 @@ class RegenerateCertificatesTest(CertificateManagementTest):
username=self.user.email, course=unicode(key), noop=False, insecure=True, template_file=None, username=self.user.email, course=unicode(key), noop=False, insecure=True, template_file=None,
grade_value=None grade_value=None
) )
certificate = GeneratedCertificate.eligible_certificates.get( certificate = GeneratedCertificate.objects.get(
user=self.user, user=self.user,
course_id=key course_id=key
) )
...@@ -239,7 +236,7 @@ class UngenerateCertificatesTest(CertificateManagementTest): ...@@ -239,7 +236,7 @@ class UngenerateCertificatesTest(CertificateManagementTest):
course=unicode(key), noop=False, insecure=True, force=False course=unicode(key), noop=False, insecure=True, force=False
) )
self.assertTrue(mock_send_to_queue.called) self.assertTrue(mock_send_to_queue.called)
certificate = GeneratedCertificate.eligible_certificates.get( certificate = GeneratedCertificate.objects.get(
user=self.user, user=self.user,
course_id=key course_id=key
) )
......
...@@ -28,7 +28,7 @@ class CreateFakeCertTest(TestCase): ...@@ -28,7 +28,7 @@ class CreateFakeCertTest(TestCase):
cert_mode='verified', cert_mode='verified',
grade='0.89' grade='0.89'
) )
cert = GeneratedCertificate.eligible_certificates.get(user=self.user, course_id=self.COURSE_KEY) cert = GeneratedCertificate.objects.get(user=self.user, course_id=self.COURSE_KEY)
self.assertEqual(cert.status, 'downloadable') self.assertEqual(cert.status, 'downloadable')
self.assertEqual(cert.mode, 'verified') self.assertEqual(cert.mode, 'verified')
self.assertEqual(cert.grade, '0.89') self.assertEqual(cert.grade, '0.89')
...@@ -41,7 +41,7 @@ class CreateFakeCertTest(TestCase): ...@@ -41,7 +41,7 @@ class CreateFakeCertTest(TestCase):
unicode(self.COURSE_KEY), unicode(self.COURSE_KEY),
cert_mode='honor' cert_mode='honor'
) )
cert = GeneratedCertificate.eligible_certificates.get(user=self.user, course_id=self.COURSE_KEY) cert = GeneratedCertificate.objects.get(user=self.user, course_id=self.COURSE_KEY)
self.assertEqual(cert.mode, 'honor') self.assertEqual(cert.mode, 'honor')
def test_too_few_args(self): def test_too_few_args(self):
......
...@@ -8,20 +8,13 @@ from django.test.utils import override_settings ...@@ -8,20 +8,13 @@ from django.test.utils import override_settings
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from path import Path as path from path import Path as path
from opaque_keys.edx.locator import CourseLocator
from certificates.models import ( from certificates.models import (
ExampleCertificate, ExampleCertificate,
ExampleCertificateSet, ExampleCertificateSet,
CertificateHtmlViewConfiguration, CertificateHtmlViewConfiguration,
CertificateTemplateAsset, CertificateTemplateAsset,
BadgeImageConfiguration, BadgeImageConfiguration)
EligibleCertificateManager,
GeneratedCertificate,
)
from certificates.tests.factories import GeneratedCertificateFactory
from opaque_keys.edx.locator import CourseLocator
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
FEATURES_INVALID_FILE_PATH = settings.FEATURES.copy() FEATURES_INVALID_FILE_PATH = settings.FEATURES.copy()
FEATURES_INVALID_FILE_PATH['CERTS_HTML_VIEW_CONFIG_PATH'] = 'invalid/path/to/config.json' FEATURES_INVALID_FILE_PATH['CERTS_HTML_VIEW_CONFIG_PATH'] = 'invalid/path/to/config.json'
...@@ -241,42 +234,3 @@ class CertificateTemplateAssetTest(TestCase): ...@@ -241,42 +234,3 @@ class CertificateTemplateAssetTest(TestCase):
certificate_template_asset = CertificateTemplateAsset.objects.get(id=1) certificate_template_asset = CertificateTemplateAsset.objects.get(id=1)
self.assertEqual(certificate_template_asset.asset, 'certificate_template_assets/1/picture2.jpg') self.assertEqual(certificate_template_asset.asset, 'certificate_template_assets/1/picture2.jpg')
@attr('shard_1')
class EligibleCertificateManagerTest(SharedModuleStoreTestCase):
"""
Test the GeneratedCertificate model's object manager for filtering
out ineligible certs.
"""
@classmethod
def setUpClass(cls):
super(EligibleCertificateManagerTest, cls).setUpClass()
cls.courses = (CourseFactory(), CourseFactory())
def setUp(self):
super(EligibleCertificateManagerTest, self).setUp()
self.user = UserFactory()
self.eligible_cert = GeneratedCertificateFactory.create(
eligible_for_certificate=True,
user=self.user,
course_id=self.courses[0].id # pylint: disable=no-member
)
self.ineligible_cert = GeneratedCertificateFactory.create(
eligible_for_certificate=False,
user=self.user,
course_id=self.courses[1].id # pylint: disable=no-member
)
def test_filter_ineligible_certificates(self):
"""
Verify that the EligibleCertificateManager filters out
certificates marked as ineligible, and that the default object
manager for GeneratedCertificate does not filter them out.
"""
self.assertEqual(list(GeneratedCertificate.eligible_certificates.filter(user=self.user)), [self.eligible_cert])
self.assertEqual(
list(GeneratedCertificate.objects.filter(user=self.user)), # pylint: disable=no-member
[self.eligible_cert, self.ineligible_cert]
)
...@@ -9,7 +9,6 @@ from nose.plugins.attrib import attr ...@@ -9,7 +9,6 @@ from nose.plugins.attrib import attr
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from course_modes.models import CourseMode
from opaque_keys.edx.locator import CourseLocator from opaque_keys.edx.locator import CourseLocator
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from student.tests.factories import UserFactory, CourseEnrollmentFactory from student.tests.factories import UserFactory, CourseEnrollmentFactory
...@@ -23,14 +22,13 @@ from xmodule.modulestore.tests.factories import CourseFactory ...@@ -23,14 +22,13 @@ from xmodule.modulestore.tests.factories import CourseFactory
# in our `XQueueCertInterface` implementation. # in our `XQueueCertInterface` implementation.
from capa.xqueue_interface import XQueueInterface from capa.xqueue_interface import XQueueInterface
from certificates.queue import XQueueCertInterface
from certificates.models import ( from certificates.models import (
ExampleCertificateSet, ExampleCertificateSet,
ExampleCertificate, ExampleCertificate,
GeneratedCertificate, GeneratedCertificate,
CertificateStatuses, CertificateStatuses,
) )
from certificates.queue import XQueueCertInterface
from certificates.tests.factories import CertificateWhitelistFactory, GeneratedCertificateFactory
from lms.djangoapps.verify_student.tests.factories import SoftwareSecurePhotoVerificationFactory from lms.djangoapps.verify_student.tests.factories import SoftwareSecurePhotoVerificationFactory
...@@ -76,7 +74,7 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase): ...@@ -76,7 +74,7 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
# Verify that add_cert method does not add message to queue # Verify that add_cert method does not add message to queue
self.assertFalse(mock_send.called) self.assertFalse(mock_send.called)
certificate = GeneratedCertificate.eligible_certificates.get(user=self.user, course_id=self.course.id) certificate = GeneratedCertificate.objects.get(user=self.user, course_id=self.course.id)
self.assertEqual(certificate.status, CertificateStatuses.downloadable) self.assertEqual(certificate.status, CertificateStatuses.downloadable)
self.assertIsNotNone(certificate.verify_uuid) self.assertIsNotNone(certificate.verify_uuid)
...@@ -86,11 +84,7 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase): ...@@ -86,11 +84,7 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
template_name = 'certificate-template-{id.org}-{id.course}.pdf'.format( template_name = 'certificate-template-{id.org}-{id.course}.pdf'.format(
id=self.course.id id=self.course.id
) )
mock_send = self.add_cert_to_queue(mode) self.assert_queue_response(mode, mode, template_name)
if CourseMode.is_eligible_for_certificate(mode):
self.assert_certificate_generated(mock_send, mode, template_name)
else:
self.assert_ineligible_certificate_generated(mock_send, mode)
@ddt.data('credit', 'verified') @ddt.data('credit', 'verified')
def test_add_cert_with_verified_certificates(self, mode): def test_add_cert_with_verified_certificates(self, mode):
...@@ -101,40 +95,10 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase): ...@@ -101,40 +95,10 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
id=self.course.id id=self.course.id
) )
mock_send = self.add_cert_to_queue(mode) self.assert_queue_response(mode, 'verified', template_name)
self.assert_certificate_generated(mock_send, 'verified', template_name)
def test_ineligible_cert_whitelisted(self):
"""Test that audit mode students can receive a certificate if they are whitelisted."""
# Enroll as audit
CourseEnrollmentFactory(
user=self.user_2,
course_id=self.course.id,
is_active=True,
mode='audit'
)
# Whitelist student
CertificateWhitelistFactory(course_id=self.course.id, user=self.user_2)
# Generate certs
with patch('courseware.grades.grade', Mock(return_value={'grade': 'Pass', 'percent': 0.75})):
with patch.object(XQueueInterface, 'send_to_queue') as mock_send:
mock_send.return_value = (0, None)
self.xqueue.add_cert(self.user_2, self.course.id)
# Assert cert generated correctly
self.assertTrue(mock_send.called)
certificate = GeneratedCertificate.certificate_for_student(self.user_2, self.course.id)
self.assertIsNotNone(certificate)
self.assertEqual(certificate.mode, 'audit')
def add_cert_to_queue(self, mode): def assert_queue_response(self, mode, expected_mode, expected_template_name):
""" """Dry method for course enrollment and adding request to queue."""
Dry method for course enrollment and adding request to
queue. Returns a mock object containing information about the
`XQueueInterface.send_to_queue` method, which can be used in other
assertions.
"""
CourseEnrollmentFactory( CourseEnrollmentFactory(
user=self.user_2, user=self.user_2,
course_id=self.course.id, course_id=self.course.id,
...@@ -145,97 +109,19 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase): ...@@ -145,97 +109,19 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
with patch.object(XQueueInterface, 'send_to_queue') as mock_send: with patch.object(XQueueInterface, 'send_to_queue') as mock_send:
mock_send.return_value = (0, None) mock_send.return_value = (0, None)
self.xqueue.add_cert(self.user_2, self.course.id) self.xqueue.add_cert(self.user_2, self.course.id)
return mock_send
def assert_certificate_generated(self, mock_send, expected_mode, expected_template_name):
"""
Assert that a certificate was generated with the correct mode and
template type.
"""
# Verify that the task was sent to the queue with the correct callback URL # Verify that the task was sent to the queue with the correct callback URL
self.assertTrue(mock_send.called) self.assertTrue(mock_send.called)
__, kwargs = mock_send.call_args_list[0] __, kwargs = mock_send.call_args_list[0]
actual_header = json.loads(kwargs['header']) actual_header = json.loads(kwargs['header'])
self.assertIn('https://edx.org/update_certificate?key=', actual_header['lms_callback_url']) self.assertIn('https://edx.org/update_certificate?key=', actual_header['lms_callback_url'])
certificate = GeneratedCertificate.objects.get(user=self.user_2, course_id=self.course.id)
self.assertEqual(certificate.mode, expected_mode)
body = json.loads(kwargs['body']) body = json.loads(kwargs['body'])
self.assertIn(expected_template_name, body['template_pdf']) self.assertIn(expected_template_name, body['template_pdf'])
certificate = GeneratedCertificate.eligible_certificates.get(user=self.user_2, course_id=self.course.id)
self.assertEqual(certificate.mode, expected_mode)
def assert_ineligible_certificate_generated(self, mock_send, expected_mode):
"""
Assert that an ineligible certificate was generated with the
correct mode.
"""
# Ensure the certificate was not generated
self.assertFalse(mock_send.called)
certificate = GeneratedCertificate.objects.get( # pylint: disable=no-member
user=self.user_2,
course_id=self.course.id
)
self.assertFalse(certificate.eligible_for_certificate)
self.assertEqual(certificate.mode, expected_mode)
@ddt.data(
(CertificateStatuses.restricted, False),
(CertificateStatuses.deleting, False),
(CertificateStatuses.generating, True),
(CertificateStatuses.unavailable, True),
(CertificateStatuses.deleted, True),
(CertificateStatuses.error, True),
(CertificateStatuses.notpassing, True),
(CertificateStatuses.downloadable, True),
(CertificateStatuses.auditing, True),
)
@ddt.unpack
def test_add_cert_statuses(self, status, should_generate):
"""
Test that certificates can or cannot be generated with the given
certificate status.
"""
with patch('certificates.queue.certificate_status_for_student', Mock(return_value={'status': status})):
mock_send = self.add_cert_to_queue('verified')
if should_generate:
self.assertTrue(mock_send.called)
else:
self.assertFalse(mock_send.called)
def test_old_audit_cert_eligible(self):
"""
Test that existing audit certificates remain eligible even if cert
generation is re-run.
"""
# Create an existing audit enrollment and certificate
CourseEnrollmentFactory(
user=self.user_2,
course_id=self.course.id,
is_active=True,
mode=CourseMode.AUDIT,
)
GeneratedCertificateFactory(
user=self.user_2,
course_id=self.course.id,
grade='1.0',
status=CertificateStatuses.downloadable,
mode=GeneratedCertificate.MODES.audit,
eligible_for_certificate=True,
)
# Run grading/cert generation again
with patch('courseware.grades.grade', Mock(return_value={'grade': 'Pass', 'percent': 0.75})):
with patch.object(XQueueInterface, 'send_to_queue') as mock_send:
mock_send.return_value = (0, None)
self.xqueue.add_cert(self.user_2, self.course.id)
self.assertTrue(
GeneratedCertificate.objects.get(user=self.user_2, course_id=self.course.id).eligible_for_certificate # pylint: disable=no-member
)
@attr('shard_1') @attr('shard_1')
@override_settings(CERT_QUEUE='certificates') @override_settings(CERT_QUEUE='certificates')
......
...@@ -71,7 +71,7 @@ class CertificateSupportTestCase(ModuleStoreTestCase): ...@@ -71,7 +71,7 @@ class CertificateSupportTestCase(ModuleStoreTestCase):
) )
# Create certificates for the student # Create certificates for the student
self.cert = GeneratedCertificate.eligible_certificates.create( self.cert = GeneratedCertificate.objects.create(
user=self.student, user=self.student,
course_id=self.CERT_COURSE_KEY, course_id=self.CERT_COURSE_KEY,
grade=self.CERT_GRADE, grade=self.CERT_GRADE,
...@@ -259,7 +259,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase): ...@@ -259,7 +259,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase):
# Check that the user's certificate was updated # Check that the user's certificate was updated
# Since the student hasn't actually passed the course, # Since the student hasn't actually passed the course,
# we'd expect that the certificate status will be "notpassing" # we'd expect that the certificate status will be "notpassing"
cert = GeneratedCertificate.eligible_certificates.get(user=self.student) cert = GeneratedCertificate.objects.get(user=self.student)
self.assertEqual(cert.status, CertificateStatuses.notpassing) self.assertEqual(cert.status, CertificateStatuses.notpassing)
def test_regenerate_certificate_missing_params(self): def test_regenerate_certificate_missing_params(self):
...@@ -298,7 +298,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase): ...@@ -298,7 +298,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase):
def test_regenerate_user_has_no_certificate(self): def test_regenerate_user_has_no_certificate(self):
# Delete the user's certificate # Delete the user's certificate
GeneratedCertificate.eligible_certificates.all().delete() GeneratedCertificate.objects.all().delete()
# Should be able to regenerate # Should be able to regenerate
response = self._regenerate( response = self._regenerate(
...@@ -308,7 +308,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase): ...@@ -308,7 +308,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
# A new certificate is created # A new certificate is created
num_certs = GeneratedCertificate.eligible_certificates.filter(user=self.student).count() num_certs = GeneratedCertificate.objects.filter(user=self.student).count()
self.assertEqual(num_certs, 1) self.assertEqual(num_certs, 1)
def _regenerate(self, course_key=None, username=None): def _regenerate(self, course_key=None, username=None):
...@@ -412,7 +412,7 @@ class CertificateGenerateTests(CertificateSupportTestCase): ...@@ -412,7 +412,7 @@ class CertificateGenerateTests(CertificateSupportTestCase):
def test_generate_user_has_no_certificate(self): def test_generate_user_has_no_certificate(self):
# Delete the user's certificate # Delete the user's certificate
GeneratedCertificate.eligible_certificates.all().delete() GeneratedCertificate.objects.all().delete()
# Should be able to generate # Should be able to generate
response = self._generate( response = self._generate(
...@@ -422,7 +422,7 @@ class CertificateGenerateTests(CertificateSupportTestCase): ...@@ -422,7 +422,7 @@ class CertificateGenerateTests(CertificateSupportTestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
# A new certificate is created # A new certificate is created
num_certs = GeneratedCertificate.eligible_certificates.filter(user=self.student).count() num_certs = GeneratedCertificate.objects.filter(user=self.student).count()
self.assertEqual(num_certs, 1) self.assertEqual(num_certs, 1)
def _generate(self, course_key=None, username=None): def _generate(self, course_key=None, username=None):
......
...@@ -210,7 +210,7 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase): ...@@ -210,7 +210,7 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase):
self.user.profile.name = "Joe User" self.user.profile.name = "Joe User"
self.user.profile.save() self.user.profile.save()
self.client.login(username=self.user.username, password='foo') self.client.login(username=self.user.username, password='foo')
self.cert = GeneratedCertificate.eligible_certificates.create( self.cert = GeneratedCertificate.objects.create(
user=self.user, user=self.user,
course_id=self.course_id, course_id=self.course_id,
download_uuid=uuid4(), download_uuid=uuid4(),
......
...@@ -13,7 +13,6 @@ from django.core.urlresolvers import reverse ...@@ -13,7 +13,6 @@ from django.core.urlresolvers import reverse
from django.test.client import Client from django.test.client import Client
from django.test.utils import override_settings from django.test.utils import override_settings
from course_modes.models import CourseMode
from openedx.core.lib.tests.assertions.events import assert_event_matches from openedx.core.lib.tests.assertions.events import assert_event_matches
from student.tests.factories import UserFactory, CourseEnrollmentFactory from student.tests.factories import UserFactory, CourseEnrollmentFactory
from student.roles import CourseStaffRole from student.roles import CourseStaffRole
...@@ -97,8 +96,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase): ...@@ -97,8 +96,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
) )
CourseEnrollmentFactory.create( CourseEnrollmentFactory.create(
user=self.user, user=self.user,
course_id=self.course_id, course_id=self.course_id
mode=CourseMode.HONOR,
) )
CertificateHtmlViewConfigurationFactory.create() CertificateHtmlViewConfigurationFactory.create()
LinkedInAddToProfileConfigurationFactory.create() LinkedInAddToProfileConfigurationFactory.create()
...@@ -380,32 +378,6 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase): ...@@ -380,32 +378,6 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
self.assertIn("Cannot Find Certificate", response.content) self.assertIn("Cannot Find Certificate", response.content)
self.assertIn("We cannot find a certificate with this URL or ID number.", response.content) self.assertIn("We cannot find a certificate with this URL or ID number.", response.content)
@ddt.data(True, False)
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
def test_audit_certificate_display(self, eligible_for_certificate):
"""
Ensure that audit-mode certs are not shown in the web view.
"""
# Convert the cert to audit, with the specified eligibility
self.cert.mode = 'audit'
self.cert.eligible_for_certificate = eligible_for_certificate
self.cert.save()
self._add_course_certificates(count=1, signatory_count=2)
test_url = get_certificate_url(
user_id=self.user.id,
course_id=unicode(self.course.id)
)
response = self.client.get(test_url)
if eligible_for_certificate:
self.assertIn(str(self.cert.verify_uuid), response.content)
else:
self.assertIn("Invalid Certificate", response.content)
self.assertIn("Cannot Find Certificate", response.content)
self.assertIn("We cannot find a certificate with this URL or ID number.", response.content)
self.assertNotIn(str(self.cert.verify_uuid), response.content)
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED) @override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
def test_html_view_for_invalid_certificate(self): def test_html_view_for_invalid_certificate(self):
""" """
...@@ -561,7 +533,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase): ...@@ -561,7 +533,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
course_id=unicode(self.course.id) course_id=unicode(self.course.id)
) )
self.cert.delete() self.cert.delete()
self.assertEqual(len(GeneratedCertificate.eligible_certificates.all()), 0) self.assertEqual(len(GeneratedCertificate.objects.all()), 0)
response = self.client.get(test_url) response = self.client.get(test_url)
self.assertIn('invalid', response.content) self.assertIn('invalid', response.content)
...@@ -584,7 +556,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase): ...@@ -584,7 +556,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
preview mode. Either the certificate is marked active or not. preview mode. Either the certificate is marked active or not.
""" """
self.cert.delete() self.cert.delete()
self.assertEqual(len(GeneratedCertificate.eligible_certificates.all()), 0) self.assertEqual(len(GeneratedCertificate.objects.all()), 0)
self._add_course_certificates(count=1, signatory_count=2) self._add_course_certificates(count=1, signatory_count=2)
test_url = get_certificate_url( test_url = get_certificate_url(
user_id=self.user.id, user_id=self.user.id,
......
...@@ -342,7 +342,7 @@ def _get_user_certificate(request, user, course_key, course, preview_mode=None): ...@@ -342,7 +342,7 @@ def _get_user_certificate(request, user, course_key, course, preview_mode=None):
else: else:
# certificate is being viewed by learner or public # certificate is being viewed by learner or public
try: try:
user_certificate = GeneratedCertificate.eligible_certificates.get( user_certificate = GeneratedCertificate.objects.get(
user=user, user=user,
course_id=course_key, course_id=course_key,
status=CertificateStatuses.downloadable status=CertificateStatuses.downloadable
...@@ -459,7 +459,7 @@ def render_cert_by_uuid(request, certificate_uuid): ...@@ -459,7 +459,7 @@ def render_cert_by_uuid(request, certificate_uuid):
This public view generates an HTML representation of the specified certificate This public view generates an HTML representation of the specified certificate
""" """
try: try:
certificate = GeneratedCertificate.eligible_certificates.get( certificate = GeneratedCertificate.objects.get(
verify_uuid=certificate_uuid, verify_uuid=certificate_uuid,
status=CertificateStatuses.downloadable status=CertificateStatuses.downloadable
) )
......
...@@ -75,7 +75,7 @@ def update_certificate(request): ...@@ -75,7 +75,7 @@ def update_certificate(request):
try: try:
course_key = SlashSeparatedCourseKey.from_deprecated_string(xqueue_body['course_id']) course_key = SlashSeparatedCourseKey.from_deprecated_string(xqueue_body['course_id'])
cert = GeneratedCertificate.eligible_certificates.get( cert = GeneratedCertificate.objects.get(
user__username=xqueue_body['username'], user__username=xqueue_body['username'],
course_id=course_key, course_id=course_key,
key=xqueue_header['lms_key']) key=xqueue_header['lms_key'])
......
...@@ -619,7 +619,7 @@ class CertificateExceptionViewInstructorApiTest(SharedModuleStoreTestCase): ...@@ -619,7 +619,7 @@ class CertificateExceptionViewInstructorApiTest(SharedModuleStoreTestCase):
# Verify that certificate exception successfully removed from CertificateWhitelist and GeneratedCertificate # Verify that certificate exception successfully removed from CertificateWhitelist and GeneratedCertificate
with self.assertRaises(ObjectDoesNotExist): with self.assertRaises(ObjectDoesNotExist):
CertificateWhitelist.objects.get(user=self.user2, course_id=self.course.id) CertificateWhitelist.objects.get(user=self.user2, course_id=self.course.id)
GeneratedCertificate.eligible_certificates.get( GeneratedCertificate.objects.get(
user=self.user2, course_id=self.course.id, status__not=CertificateStatuses.unavailable user=self.user2, course_id=self.course.id, status__not=CertificateStatuses.unavailable
) )
...@@ -1010,7 +1010,7 @@ class CertificateInvalidationViewTests(SharedModuleStoreTestCase): ...@@ -1010,7 +1010,7 @@ class CertificateInvalidationViewTests(SharedModuleStoreTestCase):
self.fail("The certificate is not invalidated.") self.fail("The certificate is not invalidated.")
# Validate generated certificate was invalidated # Validate generated certificate was invalidated
generated_certificate = GeneratedCertificate.eligible_certificates.get( generated_certificate = GeneratedCertificate.objects.get(
user=self.enrolled_user_1, user=self.enrolled_user_1,
course_id=self.course.id, course_id=self.course.id,
) )
......
...@@ -2875,7 +2875,7 @@ def add_certificate_exception(course_key, student, certificate_exception): ...@@ -2875,7 +2875,7 @@ def add_certificate_exception(course_key, student, certificate_exception):
} }
) )
generated_certificate = GeneratedCertificate.eligible_certificates.filter( generated_certificate = GeneratedCertificate.objects.filter(
user=student, user=student,
course_id=course_key, course_id=course_key,
status=CertificateStatuses.downloadable, status=CertificateStatuses.downloadable,
...@@ -2912,10 +2912,7 @@ def remove_certificate_exception(course_key, student): ...@@ -2912,10 +2912,7 @@ def remove_certificate_exception(course_key, student):
) )
try: try:
generated_certificate = GeneratedCertificate.objects.get( # pylint: disable=no-member generated_certificate = GeneratedCertificate.objects.get(user=student, course_id=course_key)
user=student,
course_id=course_key
)
generated_certificate.invalidate() generated_certificate.invalidate()
except ObjectDoesNotExist: except ObjectDoesNotExist:
# Certificate has not been generated yet, so just remove the certificate exception from white list # Certificate has not been generated yet, so just remove the certificate exception from white list
......
...@@ -185,7 +185,7 @@ def issued_certificates(course_key, features): ...@@ -185,7 +185,7 @@ def issued_certificates(course_key, features):
report_run_date = datetime.date.today().strftime("%B %d, %Y") report_run_date = datetime.date.today().strftime("%B %d, %Y")
certificate_features = [x for x in CERTIFICATE_FEATURES if x in features] certificate_features = [x for x in CERTIFICATE_FEATURES if x in features]
generated_certificates = list(GeneratedCertificate.eligible_certificates.filter( generated_certificates = list(GeneratedCertificate.objects.filter(
course_id=course_key, course_id=course_key,
status=CertificateStatuses.downloadable status=CertificateStatuses.downloadable
).values(*certificate_features).annotate(total_issued_certificate=Count('mode'))) ).values(*certificate_features).annotate(total_issued_certificate=Count('mode')))
......
...@@ -1584,7 +1584,7 @@ def invalidate_generated_certificates(course_id, enrolled_students, certificate_ ...@@ -1584,7 +1584,7 @@ def invalidate_generated_certificates(course_id, enrolled_students, certificate_
:param enrolled_students: (queryset or list) students enrolled in the course :param enrolled_students: (queryset or list) students enrolled in the course
:param certificate_statuses: certificates statuses for whom to remove generated certificate :param certificate_statuses: certificates statuses for whom to remove generated certificate
""" """
certificates = GeneratedCertificate.objects.filter( # pylint: disable=no-member certificates = GeneratedCertificate.objects.filter(
user__in=enrolled_students, user__in=enrolled_students,
course_id=course_id, course_id=course_id,
status__in=certificate_statuses, status__in=certificate_statuses,
......
...@@ -1802,7 +1802,7 @@ class TestCertificateGeneration(InstructorTaskModuleTestCase): ...@@ -1802,7 +1802,7 @@ class TestCertificateGeneration(InstructorTaskModuleTestCase):
}, },
result result
) )
generated_certificates = GeneratedCertificate.eligible_certificates.filter( generated_certificates = GeneratedCertificate.objects.filter(
user__in=students, user__in=students,
course_id=self.course.id, course_id=self.course.id,
mode='honor' mode='honor'
...@@ -1912,7 +1912,7 @@ class TestCertificateGeneration(InstructorTaskModuleTestCase): ...@@ -1912,7 +1912,7 @@ class TestCertificateGeneration(InstructorTaskModuleTestCase):
result result
) )
generated_certificates = GeneratedCertificate.eligible_certificates.filter( generated_certificates = GeneratedCertificate.objects.filter(
user__in=students, user__in=students,
course_id=self.course.id, course_id=self.course.id,
mode='honor' mode='honor'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment