Revert "Disable audit certificates for new audit enrollments."
This reverts commit 60860e3aa8.
This commit is contained in:
@@ -592,18 +592,6 @@ class CourseMode(models.Model):
|
||||
modes = cls.modes_for_course(course_id)
|
||||
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):
|
||||
"""
|
||||
Takes a mode model and turns it into a model named tuple.
|
||||
|
||||
@@ -430,16 +430,3 @@ class CourseModeModelTest(TestCase):
|
||||
verified_mode.expiration_datetime = None
|
||||
self.assertFalse(verified_mode.expiration_datetime_is_explicit)
|
||||
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)
|
||||
|
||||
@@ -97,9 +97,7 @@ class Command(BaseCommand):
|
||||
cert_grades = {
|
||||
cert.user.username: cert.grade
|
||||
for cert in list(
|
||||
GeneratedCertificate.objects.filter( # pylint: disable=no-member
|
||||
course_id=course_key
|
||||
).prefetch_related('user')
|
||||
GeneratedCertificate.objects.filter(course_id=course_key).prefetch_related('user')
|
||||
)
|
||||
}
|
||||
print "Grading students"
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -20,8 +20,8 @@ CREATE TABLE `assessment_aiclassifier` (
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `assessment_aiclassifier_962f069f` (`classifier_set_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `assessment_aiclassifierset`;
|
||||
@@ -72,9 +72,9 @@ CREATE TABLE `assessment_aigradingworkflow` (
|
||||
KEY `assessment_aigradingworkflow_a4079fcf` (`assessment_id`),
|
||||
KEY `assessment_aigradingworkflow_962f069f` (`classifier_set_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `assessment_aitrainingworkflow`;
|
||||
@@ -110,8 +110,8 @@ CREATE TABLE `assessment_aitrainingworkflow_training_examples` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `aitrainingworkflow_id` (`aitrainingworkflow_id`,`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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `assessment_assessment`;
|
||||
@@ -154,8 +154,8 @@ CREATE TABLE `assessment_assessmentfeedback_assessments` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `assessmentfeedback_id` (`assessmentfeedback_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `assessment_assessmentfeedback_options`;
|
||||
@@ -168,8 +168,8 @@ CREATE TABLE `assessment_assessmentfeedback_options` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `assessmentfeedback_id` (`assessmentfeedback_id`,`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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `assessment_assessmentfeedbackoption`;
|
||||
@@ -196,8 +196,8 @@ CREATE TABLE `assessment_assessmentpart` (
|
||||
KEY `assessment_assessmentpart_385b00a3` (`criterion_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `assessment_criterion`;
|
||||
@@ -272,9 +272,9 @@ CREATE TABLE `assessment_peerworkflowitem` (
|
||||
KEY `assessm_scorer_id_2d803ee2d52c0e2c_fk_assessment_peerworkflow_id` (`scorer_id`),
|
||||
KEY `assessment_peerworkflowitem_ab5b2b73` (`submission_uuid`),
|
||||
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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `assessment_rubric`;
|
||||
@@ -289,6 +289,32 @@ CREATE TABLE `assessment_rubric` (
|
||||
KEY `assessment_rubric_873e9e2d` (`structure_hash`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!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`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
@@ -319,8 +345,8 @@ CREATE TABLE `assessment_studenttrainingworkflowitem` (
|
||||
UNIQUE KEY `assessment_studenttrainingwork_workflow_id_484e930feb86ad74_uniq` (`workflow_id`,`order_num`),
|
||||
KEY `assessment_studenttrainingworkflowitem_9cc97abc` (`training_example_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `assessment_trainingexample`;
|
||||
@@ -386,7 +412,7 @@ CREATE TABLE `auth_permission` (
|
||||
PRIMARY KEY (`id`),
|
||||
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`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=716 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=737 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `auth_registration`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
@@ -840,7 +866,6 @@ CREATE TABLE `certificates_generatedcertificate` (
|
||||
`modified_date` datetime(6) NOT NULL,
|
||||
`error_reason` varchar(512) NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`eligible_for_certificate` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `certificates_generatedcertificate_user_id_552a0fa6f7d3f7e8_uniq` (`user_id`,`course_id`),
|
||||
KEY `certificates_generatedcertific_verify_uuid_1b5a14bb83c471ff_uniq` (`verify_uuid`),
|
||||
@@ -920,8 +945,8 @@ CREATE TABLE `course_action_state_coursererunstate` (
|
||||
KEY `course_action_state_coursererunstate_c8235886` (`course_key`),
|
||||
KEY `course_action_state_coursererunstate_418c5509` (`action`),
|
||||
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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `course_creators_coursecreator`;
|
||||
@@ -950,8 +975,8 @@ CREATE TABLE `course_groups_cohortmembership` (
|
||||
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_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `course_groups_coursecohort`;
|
||||
@@ -1031,12 +1056,12 @@ CREATE TABLE `course_modes_coursemode` (
|
||||
`mode_display_name` varchar(255) NOT NULL,
|
||||
`min_price` int(11) NOT NULL,
|
||||
`currency` varchar(8) NOT NULL,
|
||||
`expiration_datetime` datetime(6) DEFAULT NULL,
|
||||
`expiration_date` date DEFAULT NULL,
|
||||
`suggested_prices` varchar(255) NOT NULL,
|
||||
`description` longtext,
|
||||
`sku` varchar(255) DEFAULT NULL,
|
||||
`expiration_datetime_is_explicit` tinyint(1) NOT NULL,
|
||||
`expiration_datetime` datetime(6) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `course_modes_coursemode_course_id_6fbb1796ace558b4_uniq` (`course_id`,`mode_slug`,`currency`),
|
||||
KEY `course_modes_coursemode_ea134da7` (`course_id`)
|
||||
@@ -1515,8 +1540,8 @@ CREATE TABLE `django_admin_log` (
|
||||
PRIMARY KEY (`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`),
|
||||
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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `django_comment_client_permission`;
|
||||
@@ -1537,8 +1562,8 @@ CREATE TABLE `django_comment_client_permission_roles` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `permission_id` (`permission_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `django_comment_client_role`;
|
||||
@@ -1575,7 +1600,7 @@ CREATE TABLE `django_content_type` (
|
||||
`model` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
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 */;
|
||||
DROP TABLE IF EXISTS `django_migrations`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
@@ -1586,7 +1611,7 @@ CREATE TABLE `django_migrations` (
|
||||
`name` varchar(255) NOT NULL,
|
||||
`applied` datetime(6) NOT NULL,
|
||||
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 */;
|
||||
DROP TABLE IF EXISTS `django_openid_auth_association`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
@@ -1694,8 +1719,8 @@ CREATE TABLE `djcelery_periodictask` (
|
||||
UNIQUE KEY `name` (`name`),
|
||||
KEY `djc_interval_id_20cfc1cad060dfad_fk_djcelery_intervalschedule_id` (`interval_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `djcelery_periodictasks`;
|
||||
@@ -1776,8 +1801,8 @@ CREATE TABLE `edxval_encodedvideo` (
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `edxval_encodedvideo_83a0eb3f` (`profile_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `edxval_profile`;
|
||||
@@ -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`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!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`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
@@ -2165,8 +2286,8 @@ CREATE TABLE `notify_subscription` (
|
||||
PRIMARY KEY (`subscription_id`),
|
||||
KEY `a2462650bbefc26547210b80dec61069` (`notification_type_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `oauth2_accesstoken`;
|
||||
@@ -2183,8 +2304,8 @@ CREATE TABLE `oauth2_accesstoken` (
|
||||
KEY `oauth2_accesstoken_94a08da1` (`token`),
|
||||
KEY `oauth2_accesstoken_2bfe9d72` (`client_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `oauth2_client`;
|
||||
@@ -2218,8 +2339,8 @@ CREATE TABLE `oauth2_grant` (
|
||||
PRIMARY KEY (`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`),
|
||||
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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `oauth2_provider_trustedclient`;
|
||||
@@ -2247,9 +2368,9 @@ CREATE TABLE `oauth2_refreshtoken` (
|
||||
UNIQUE KEY `access_token_id` (`access_token_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`),
|
||||
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__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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `oauth_provider_consumer`;
|
||||
@@ -2313,9 +2434,9 @@ CREATE TABLE `oauth_provider_token` (
|
||||
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_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_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `organizations_organization`;
|
||||
@@ -2388,8 +2509,8 @@ CREATE TABLE `proctoring_proctoredexamreviewpolicy` (
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `D32bab97500954b362d3f768dd89b6da` (`proctored_exam_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `proctoring_proctoredexamreviewpolicyhistory`;
|
||||
@@ -2407,8 +2528,8 @@ CREATE TABLE `proctoring_proctoredexamreviewpolicyhistory` (
|
||||
KEY `d9965d8af87bebd0587414ca1ba4826f` (`proctored_exam_id`),
|
||||
KEY `proctoring_procto_set_by_user_id_31fae610848d90f_fk_auth_user_id` (`set_by_user_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `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_proctored_student_id_14c182517b0cbb5b_fk_auth_user_id` (`student_id`),
|
||||
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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `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_proctored_student_id_6922ba3b791462d8_fk_auth_user_id` (`student_id`),
|
||||
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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `proctoring_proctoredexamstudentallowance`;
|
||||
@@ -2473,8 +2594,8 @@ CREATE TABLE `proctoring_proctoredexamstudentallowance` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `proctoring_proctoredexamstudentall_user_id_665ed945152c2f60_uniq` (`user_id`,`proctored_exam_id`,`key`),
|
||||
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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `proctoring_proctoredexamstudentallowancehistory`;
|
||||
@@ -2492,8 +2613,8 @@ CREATE TABLE `proctoring_proctoredexamstudentallowancehistory` (
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `D169ec97a7fca1dbf6b0bb2929d41ccc` (`proctored_exam_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `proctoring_proctoredexamstudentattempt`;
|
||||
@@ -2572,8 +2693,8 @@ CREATE TABLE `proctoring_proctoredexamstudentattempthistory` (
|
||||
KEY `proctoring_proctoredexa_user_id_59ce75db7c4fc769_fk_auth_user_id` (`user_id`),
|
||||
KEY `proctoring_proctoredexamstudentattempthistory_b38e5b0e` (`attempt_code`),
|
||||
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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `programs_programsapiconfig`;
|
||||
@@ -2658,9 +2779,9 @@ CREATE TABLE `shoppingcart_couponredemption` (
|
||||
KEY `shoppingcar_coupon_id_1afa016627ac44bb_fk_shoppingcart_coupon_id` (`coupon_id`),
|
||||
KEY `shoppingcart_couponredemption_69dfcb07` (`order_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `shoppingcart_courseregcodeitem`;
|
||||
@@ -2709,9 +2830,9 @@ CREATE TABLE `shoppingcart_courseregistrationcode` (
|
||||
KEY `shoppingcart_courseregistrationcode_69dfcb07` (`order_id`),
|
||||
KEY `shoppingcart_courseregistrationcode_7a471658` (`invoice_item_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `shoppingcart_courseregistrationcodeinvoiceitem`;
|
||||
@@ -2827,9 +2948,9 @@ CREATE TABLE `shoppingcart_invoicetransaction` (
|
||||
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 `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 `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`)
|
||||
CONSTRAINT `shoppingcart_invoi_created_by_id_f5f3d90ce55a145_fk_auth_user_id` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `shoppingcart_order`;
|
||||
@@ -2890,8 +3011,8 @@ CREATE TABLE `shoppingcart_orderitem` (
|
||||
KEY `shoppingcart_orderitem_76ed2946` (`refund_requested_time`),
|
||||
KEY `shoppingcart_orderitem_69dfcb07` (`order_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `shoppingcart_paidcourseregistration`;
|
||||
@@ -2938,8 +3059,8 @@ CREATE TABLE `shoppingcart_registrationcoderedemption` (
|
||||
KEY `D1ed44c4be114e424571929bce972f54` (`registration_code_id`),
|
||||
CONSTRAINT `D1ed44c4be114e424571929bce972f54` FOREIGN KEY (`registration_code_id`) REFERENCES `shoppingcart_courseregistrationcode` (`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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `social_auth_association`;
|
||||
@@ -3330,8 +3451,8 @@ CREATE TABLE `student_userstanding` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `user_id` (`user_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `student_usertestgroup`;
|
||||
@@ -3355,8 +3476,8 @@ CREATE TABLE `student_usertestgroup_users` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `usertestgroup_id` (`usertestgroup_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `submissions_score`;
|
||||
@@ -3374,8 +3495,8 @@ CREATE TABLE `submissions_score` (
|
||||
KEY `submissions_score_fde81f11` (`created_at`),
|
||||
KEY `submissions_score_02d5e83e` (`student_item_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `submissions_scoreannotation`;
|
||||
@@ -3407,8 +3528,8 @@ CREATE TABLE `submissions_scoresummary` (
|
||||
KEY `submissions__highest_id_7fd91b8eb312c175_fk_submissions_score_id` (`highest_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `submissions_studentitem`;
|
||||
@@ -3463,8 +3584,8 @@ CREATE TABLE `survey_surveyanswer` (
|
||||
KEY `survey_surveyanswer_c8235886` (`course_key`),
|
||||
KEY `survey_surveyanswer_d6cba1ad` (`form_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `survey_surveyform`;
|
||||
@@ -3518,8 +3639,8 @@ CREATE TABLE `teams_courseteammembership` (
|
||||
PRIMARY KEY (`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`),
|
||||
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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `third_party_auth_ltiproviderconfig`;
|
||||
@@ -3793,8 +3914,8 @@ CREATE TABLE `verify_student_skippedreverification` (
|
||||
KEY `verify_student_skippedreverification_ea134da7` (`course_id`),
|
||||
KEY `verify_student_skippedreverification_bef2d98a` (`checkpoint_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `verify_student_softwaresecurephotoverification`;
|
||||
@@ -3828,9 +3949,9 @@ CREATE TABLE `verify_student_softwaresecurephotoverification` (
|
||||
KEY `verify_student_softwaresecurephotoverification_afd1a1a8` (`updated_at`),
|
||||
KEY `verify_student_softwaresecurephotoverification_ebf78b51` (`display`),
|
||||
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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `verify_student_verificationcheckpoint`;
|
||||
@@ -3888,8 +4009,8 @@ CREATE TABLE `verify_student_verificationstatus` (
|
||||
KEY `D4cefb6d3d71c9b26af2a5ece4c37277` (`checkpoint_id`),
|
||||
KEY `verify_student_verifica_user_id_5c19fcd6dc05f211_fk_auth_user_id` (`user_id`),
|
||||
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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `wiki_article`;
|
||||
@@ -3910,9 +4031,9 @@ CREATE TABLE `wiki_article` (
|
||||
UNIQUE KEY `current_revision_id` (`current_revision_id`),
|
||||
KEY `wiki_article_0e939a4f` (`group_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `wiki_articleforobject`;
|
||||
@@ -3966,9 +4087,9 @@ CREATE TABLE `wiki_articlerevision` (
|
||||
UNIQUE KEY `wiki_articlerevision_article_id_4b4e7910c8e7b2d0_uniq` (`article_id`,`revision_number`),
|
||||
KEY `fae2b1c6e892c699844d5dda69aeb89e` (`previous_revision_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `wiki_attachment`;
|
||||
@@ -4006,9 +4127,9 @@ CREATE TABLE `wiki_attachmentrevision` (
|
||||
KEY `wiki_attachmentrevision_07ba63f5` (`attachment_id`),
|
||||
KEY `wiki_attachmentrevision_e8680b8a` (`previous_revision_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `wiki_image`;
|
||||
@@ -4051,8 +4172,8 @@ CREATE TABLE `wiki_reusableplugin_articles` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `reusableplugin_id` (`reusableplugin_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `wiki_revisionplugin`;
|
||||
@@ -4087,9 +4208,9 @@ CREATE TABLE `wiki_revisionpluginrevision` (
|
||||
KEY `wiki_revisionpluginrevision_b25eaab4` (`plugin_id`),
|
||||
KEY `wiki_revisionpluginrevision_e8680b8a` (`previous_revision_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 `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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `wiki_simpleplugin`;
|
||||
@@ -4126,9 +4247,9 @@ CREATE TABLE `wiki_urlpath` (
|
||||
KEY `wiki_urlpath_656442a0` (`tree_id`),
|
||||
KEY `wiki_urlpath_c9e9a848` (`level`),
|
||||
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_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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS `workflow_assessmentworkflow`;
|
||||
|
||||
@@ -78,7 +78,7 @@ def get_certificates_for_user(username):
|
||||
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,
|
||||
if insecure:
|
||||
xqueue.use_https = False
|
||||
generate_pdf = not has_html_certificates_enabled(course_key, course)
|
||||
cert = xqueue.add_cert(
|
||||
student,
|
||||
course_key,
|
||||
course=course,
|
||||
generate_pdf=generate_pdf,
|
||||
forced_grade=forced_grade
|
||||
)
|
||||
if cert.status in [CertificateStatuses.generating, CertificateStatuses.downloadable]:
|
||||
status, cert = xqueue.add_cert(student, course_key,
|
||||
course=course,
|
||||
generate_pdf=generate_pdf,
|
||||
forced_grade=forced_grade)
|
||||
if status in [CertificateStatuses.generating, CertificateStatuses.downloadable]:
|
||||
emit_certificate_event('created', student, course_key, course, {
|
||||
'user_id': student.id,
|
||||
'course_id': unicode(course_key),
|
||||
@@ -124,7 +121,7 @@ def generate_user_certificates(student, course_key, course=None, insecure=False,
|
||||
'enrollment_mode': cert.mode,
|
||||
'generation_mode': generation_mode
|
||||
})
|
||||
return cert.status
|
||||
return status
|
||||
|
||||
|
||||
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):
|
||||
)
|
||||
return url
|
||||
try:
|
||||
user_certificate = GeneratedCertificate.eligible_certificates.get(
|
||||
user_certificate = GeneratedCertificate.objects.get(
|
||||
user=user_id,
|
||||
course_id=course_id
|
||||
)
|
||||
|
||||
@@ -76,7 +76,7 @@ class Command(BaseCommand):
|
||||
status = options.get('status', CertificateStatuses.downloadable)
|
||||
grade = options.get('grade', '')
|
||||
|
||||
cert, created = GeneratedCertificate.eligible_certificates.get_or_create(
|
||||
cert, created = GeneratedCertificate.objects.get_or_create(
|
||||
user=user,
|
||||
course_id=course_key
|
||||
)
|
||||
|
||||
@@ -42,9 +42,8 @@ class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
course_id = options['course']
|
||||
print "Fetching ungraded students for {0}".format(course_id)
|
||||
ungraded = GeneratedCertificate.objects.filter( # pylint: disable=no-member
|
||||
course_id__exact=course_id
|
||||
).filter(grade__exact='')
|
||||
ungraded = GeneratedCertificate.objects.filter(
|
||||
course_id__exact=course_id).filter(grade__exact='')
|
||||
course = courses.get_course_by_id(course_id)
|
||||
factory = RequestFactory()
|
||||
request = factory.get('/')
|
||||
|
||||
@@ -70,17 +70,14 @@ class Command(BaseCommand):
|
||||
enrolled_total = User.objects.filter(
|
||||
courseenrollment__course_id=course_id
|
||||
)
|
||||
verified_enrolled = GeneratedCertificate.objects.filter( # pylint: disable=no-member
|
||||
course_id__exact=course_id,
|
||||
mode__exact='verified'
|
||||
verified_enrolled = GeneratedCertificate.objects.filter(
|
||||
course_id__exact=course_id, mode__exact='verified'
|
||||
)
|
||||
honor_enrolled = GeneratedCertificate.objects.filter( # pylint: disable=no-member
|
||||
course_id__exact=course_id,
|
||||
mode__exact='honor'
|
||||
honor_enrolled = GeneratedCertificate.objects.filter(
|
||||
course_id__exact=course_id, mode__exact='honor'
|
||||
)
|
||||
audit_enrolled = GeneratedCertificate.objects.filter( # pylint: disable=no-member
|
||||
course_id__exact=course_id,
|
||||
mode__exact='audit'
|
||||
audit_enrolled = GeneratedCertificate.objects.filter(
|
||||
course_id__exact=course_id, mode__exact='audit'
|
||||
)
|
||||
|
||||
cert_data[course_id] = {
|
||||
@@ -91,7 +88,7 @@ class Command(BaseCommand):
|
||||
'audit_enrolled': audit_enrolled.count()
|
||||
}
|
||||
|
||||
status_tally = GeneratedCertificate.objects.filter( # pylint: disable=no-member
|
||||
status_tally = GeneratedCertificate.objects.filter(
|
||||
course_id__exact=course_id
|
||||
).values('status').annotate(
|
||||
dcount=Count('status')
|
||||
@@ -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,
|
||||
status__exact='downloadable'
|
||||
).values('mode').annotate(
|
||||
|
||||
@@ -81,7 +81,7 @@ class Command(BaseCommand):
|
||||
# Retrieve the IDs of generated certificates with
|
||||
# error status in the set of courses we're considering.
|
||||
queryset = (
|
||||
GeneratedCertificate.objects.select_related('user') # pylint: disable=no-member
|
||||
GeneratedCertificate.objects.select_related('user')
|
||||
).filter(status=CertificateStatuses.error)
|
||||
if only_course_keys:
|
||||
queryset = queryset.filter(course_id__in=only_course_keys)
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- 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):
|
||||
if student:
|
||||
white_list = white_list.filter(user=student)
|
||||
result = []
|
||||
generated_certificates = GeneratedCertificate.eligible_certificates.filter(
|
||||
generated_certificates = GeneratedCertificate.objects.filter(
|
||||
course_id=course_id,
|
||||
user__in=[exception.user for exception in white_list],
|
||||
status=CertificateStatuses.downloadable
|
||||
@@ -168,40 +168,11 @@ class CertificateWhitelist(models.Model):
|
||||
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):
|
||||
"""
|
||||
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')
|
||||
|
||||
VERIFIED_CERTS_MODES = [CourseMode.VERIFIED, CourseMode.CREDIT_MODE]
|
||||
@@ -220,19 +191,6 @@ class GeneratedCertificate(models.Model):
|
||||
created_date = models.DateTimeField(auto_now_add=True)
|
||||
modified_date = models.DateTimeField(auto_now=True)
|
||||
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):
|
||||
unique_together = (('user', 'course_id'),)
|
||||
@@ -452,7 +410,7 @@ def certificate_status_for_student(student, course_id):
|
||||
'''
|
||||
|
||||
try:
|
||||
generated_certificate = GeneratedCertificate.objects.get( # pylint: disable=no-member
|
||||
generated_certificate = GeneratedCertificate.objects.get(
|
||||
user=student, course_id=course_id)
|
||||
cert_status = {
|
||||
'status': generated_certificate.status,
|
||||
|
||||
@@ -20,7 +20,6 @@ from student.models import UserProfile, CourseEnrollment
|
||||
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
|
||||
|
||||
from certificates.models import (
|
||||
CertificateStatuses,
|
||||
GeneratedCertificate,
|
||||
certificate_status_for_student,
|
||||
CertificateStatuses as status,
|
||||
@@ -121,14 +120,14 @@ class XQueueCertInterface(object):
|
||||
Change the certificate status to unavailable (if it exists) and request
|
||||
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
|
||||
# repo also, do a deletion followed by a creation r/t a simple
|
||||
# recreation. XXX: this leaves orphan cert files laying around in
|
||||
# AWS. See note in the docstring too.
|
||||
try:
|
||||
certificate = GeneratedCertificate.eligible_certificates.get(user=student, course_id=course_id)
|
||||
certificate = GeneratedCertificate.objects.get(user=student, course_id=course_id)
|
||||
|
||||
LOGGER.info(
|
||||
(
|
||||
@@ -184,7 +183,8 @@ class XQueueCertInterface(object):
|
||||
raise NotImplementedError
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -211,7 +211,7 @@ class XQueueCertInterface(object):
|
||||
If a student does not have a passing grade the status
|
||||
will change to status.notpassing
|
||||
|
||||
Returns the newly created certificate instance
|
||||
Returns the student's status and newly created certificate instance
|
||||
"""
|
||||
|
||||
valid_statuses = [
|
||||
@@ -225,6 +225,7 @@ class XQueueCertInterface(object):
|
||||
]
|
||||
|
||||
cert_status = certificate_status_for_student(student, course_id)['status']
|
||||
new_status = cert_status
|
||||
cert = None
|
||||
|
||||
if cert_status not in valid_statuses:
|
||||
@@ -239,98 +240,155 @@ class XQueueCertInterface(object):
|
||||
cert_status,
|
||||
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:
|
||||
# honor code and audit students
|
||||
template_pdf = "certificate-template-{id.org}-{id.course}.pdf".format(id=course_id)
|
||||
if forced_grade:
|
||||
grade['grade'] = forced_grade
|
||||
# grade the student
|
||||
|
||||
cert, __ = GeneratedCertificate.eligible_certificates.get_or_create(user=student, course_id=course_id)
|
||||
# re-use the course passed in optionally so we don't have to re-fetch everything
|
||||
# for every student
|
||||
if course is None:
|
||||
course = modulestore().get_course(course_id, depth=0)
|
||||
profile = UserProfile.objects.get(user=student)
|
||||
profile_name = profile.name
|
||||
|
||||
cert.mode = cert_mode
|
||||
cert.user = student
|
||||
cert.grade = grade['percent']
|
||||
cert.course_id = course_id
|
||||
cert.name = profile_name
|
||||
cert.download_url = ''
|
||||
# Needed
|
||||
self.request.user = student
|
||||
self.request.session = {}
|
||||
|
||||
# If this user's enrollment is not eligible to receive a
|
||||
# certificate, mark it as such for reporting and
|
||||
# analytics.
|
||||
if not is_eligible_for_certificate:
|
||||
cert.eligible_for_certificate = False
|
||||
cert.status = CertificateStatuses.auditing
|
||||
cert.save()
|
||||
LOGGER.info(
|
||||
u"Student %s with enrollment mode %s is not eligible for a certificate.",
|
||||
student.id,
|
||||
enrollment_mode
|
||||
)
|
||||
return cert
|
||||
course_name = course.display_name or unicode(course_id)
|
||||
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
|
||||
|
||||
# Strip HTML from grade range label
|
||||
grade_contents = grade.get('grade', None)
|
||||
try:
|
||||
grade_contents = lxml.html.fromstring(grade_contents).text_content()
|
||||
except (TypeError, XMLSyntaxError, ParserError) as exc:
|
||||
LOGGER.info(
|
||||
(
|
||||
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,
|
||||
unicode(course_id),
|
||||
grade_contents,
|
||||
unicode(exc)
|
||||
)
|
||||
# For credit mode generate verified certificate
|
||||
if cert_mode == CourseMode.CREDIT_MODE:
|
||||
cert_mode = CourseMode.VERIFIED
|
||||
|
||||
# Log if the student is whitelisted
|
||||
if is_whitelisted:
|
||||
LOGGER.info(
|
||||
u"Student %s is whitelisted in '%s'",
|
||||
student.id,
|
||||
unicode(course_id)
|
||||
)
|
||||
# If they are not, short-circuit and don't generate cert
|
||||
if 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:
|
||||
cert.status = status.notpassing
|
||||
# honor code and audit students
|
||||
template_pdf = "certificate-template-{id.org}-{id.course}.pdf".format(id=course_id)
|
||||
if forced_grade:
|
||||
grade['grade'] = forced_grade
|
||||
|
||||
cert, __ = GeneratedCertificate.objects.get_or_create(user=student, course_id=course_id)
|
||||
|
||||
cert.mode = cert_mode
|
||||
cert.user = student
|
||||
cert.grade = grade['percent']
|
||||
cert.course_id = course_id
|
||||
cert.name = profile_name
|
||||
cert.download_url = ''
|
||||
# Strip HTML from grade range label
|
||||
grade_contents = grade.get('grade', None)
|
||||
try:
|
||||
grade_contents = lxml.html.fromstring(grade_contents).text_content()
|
||||
except (TypeError, XMLSyntaxError, ParserError) as exc:
|
||||
LOGGER.info(
|
||||
(
|
||||
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,
|
||||
unicode(course_id),
|
||||
grade_contents,
|
||||
unicode(exc)
|
||||
)
|
||||
|
||||
# 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:
|
||||
new_status = status.notpassing
|
||||
cert.status = new_status
|
||||
cert.save()
|
||||
|
||||
LOGGER.info(
|
||||
@@ -341,85 +399,10 @@ class XQueueCertInterface(object):
|
||||
),
|
||||
student.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:
|
||||
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
|
||||
return new_status, cert
|
||||
|
||||
def add_example_cert(self, example_cert):
|
||||
"""Add a task to create an example certificate.
|
||||
|
||||
@@ -231,7 +231,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu
|
||||
certs_api.generate_user_certificates(self.student, self.course.id)
|
||||
|
||||
# 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.assert_event_emitted(
|
||||
'edx.certificate.created',
|
||||
@@ -249,7 +249,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu
|
||||
certs_api.generate_user_certificates(self.student, self.course.id)
|
||||
|
||||
# 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.assertIn(self.ERROR_REASON, cert.error_reason)
|
||||
|
||||
@@ -263,7 +263,7 @@ class GenerateUserCertificatesTest(EventTestMixin, WebCertificateTestMixin, Modu
|
||||
certs_api.generate_user_certificates(self.student, self.course.id)
|
||||
|
||||
# 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)
|
||||
|
||||
@patch.dict(settings.FEATURES, {'CERTIFICATES_HTML_VIEW': False})
|
||||
|
||||
@@ -6,7 +6,6 @@ from nose.plugins.attrib import attr
|
||||
from django.test.utils import override_settings
|
||||
from mock import patch
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from certificates.tests.factories import BadgeAssertionFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
@@ -31,17 +30,16 @@ class CertificateManagementTest(ModuleStoreTestCase):
|
||||
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. """
|
||||
# Enroll the user in the course
|
||||
CourseEnrollmentFactory.create(
|
||||
user=user,
|
||||
course_id=course_key,
|
||||
mode=mode
|
||||
course_id=course_key
|
||||
)
|
||||
|
||||
# Create the certificate
|
||||
GeneratedCertificate.eligible_certificates.create(
|
||||
GeneratedCertificate.objects.create(
|
||||
user=user,
|
||||
course_id=course_key,
|
||||
status=status
|
||||
@@ -54,7 +52,7 @@ class CertificateManagementTest(ModuleStoreTestCase):
|
||||
|
||||
def _assert_cert_status(self, course_key, user, expected_status):
|
||||
"""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)
|
||||
|
||||
|
||||
@@ -63,10 +61,9 @@ class CertificateManagementTest(ModuleStoreTestCase):
|
||||
class ResubmitErrorCertificatesTest(CertificateManagementTest):
|
||||
"""Tests for the resubmit_error_certificates management command. """
|
||||
|
||||
@ddt.data(CourseMode.HONOR, CourseMode.VERIFIED)
|
||||
def test_resubmit_error_certificate(self, mode):
|
||||
def test_resubmit_error_certificate(self):
|
||||
# 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'
|
||||
with check_mongo_calls(1):
|
||||
@@ -201,7 +198,7 @@ class RegenerateCertificatesTest(CertificateManagementTest):
|
||||
username=self.user.email, course=unicode(key), noop=False, insecure=True, template_file=None,
|
||||
grade_value=None
|
||||
)
|
||||
certificate = GeneratedCertificate.eligible_certificates.get(
|
||||
certificate = GeneratedCertificate.objects.get(
|
||||
user=self.user,
|
||||
course_id=key
|
||||
)
|
||||
@@ -239,7 +236,7 @@ class UngenerateCertificatesTest(CertificateManagementTest):
|
||||
course=unicode(key), noop=False, insecure=True, force=False
|
||||
)
|
||||
self.assertTrue(mock_send_to_queue.called)
|
||||
certificate = GeneratedCertificate.eligible_certificates.get(
|
||||
certificate = GeneratedCertificate.objects.get(
|
||||
user=self.user,
|
||||
course_id=key
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ class CreateFakeCertTest(TestCase):
|
||||
cert_mode='verified',
|
||||
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.mode, 'verified')
|
||||
self.assertEqual(cert.grade, '0.89')
|
||||
@@ -41,7 +41,7 @@ class CreateFakeCertTest(TestCase):
|
||||
unicode(self.COURSE_KEY),
|
||||
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')
|
||||
|
||||
def test_too_few_args(self):
|
||||
|
||||
@@ -8,20 +8,13 @@ from django.test.utils import override_settings
|
||||
from nose.plugins.attrib import attr
|
||||
from path import Path as path
|
||||
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from certificates.models import (
|
||||
ExampleCertificate,
|
||||
ExampleCertificateSet,
|
||||
CertificateHtmlViewConfiguration,
|
||||
CertificateTemplateAsset,
|
||||
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
|
||||
BadgeImageConfiguration)
|
||||
|
||||
FEATURES_INVALID_FILE_PATH = settings.FEATURES.copy()
|
||||
FEATURES_INVALID_FILE_PATH['CERTS_HTML_VIEW_CONFIG_PATH'] = 'invalid/path/to/config.json'
|
||||
@@ -241,42 +234,3 @@ class CertificateTemplateAssetTest(TestCase):
|
||||
|
||||
certificate_template_asset = CertificateTemplateAsset.objects.get(id=1)
|
||||
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
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from student.tests.factories import UserFactory, CourseEnrollmentFactory
|
||||
@@ -23,14 +22,13 @@ from xmodule.modulestore.tests.factories import CourseFactory
|
||||
# in our `XQueueCertInterface` implementation.
|
||||
from capa.xqueue_interface import XQueueInterface
|
||||
|
||||
from certificates.queue import XQueueCertInterface
|
||||
from certificates.models import (
|
||||
ExampleCertificateSet,
|
||||
ExampleCertificate,
|
||||
GeneratedCertificate,
|
||||
CertificateStatuses,
|
||||
)
|
||||
from certificates.queue import XQueueCertInterface
|
||||
from certificates.tests.factories import CertificateWhitelistFactory
|
||||
from lms.djangoapps.verify_student.tests.factories import SoftwareSecurePhotoVerificationFactory
|
||||
|
||||
|
||||
@@ -76,7 +74,7 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
|
||||
|
||||
# Verify that add_cert method does not add message to queue
|
||||
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.assertIsNotNone(certificate.verify_uuid)
|
||||
|
||||
@@ -86,11 +84,7 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
|
||||
template_name = 'certificate-template-{id.org}-{id.course}.pdf'.format(
|
||||
id=self.course.id
|
||||
)
|
||||
mock_send = self.add_cert_to_queue(mode)
|
||||
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)
|
||||
self.assert_queue_response(mode, mode, template_name)
|
||||
|
||||
@ddt.data('credit', 'verified')
|
||||
def test_add_cert_with_verified_certificates(self, mode):
|
||||
@@ -101,40 +95,10 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
|
||||
id=self.course.id
|
||||
)
|
||||
|
||||
mock_send = self.add_cert_to_queue(mode)
|
||||
self.assert_certificate_generated(mock_send, 'verified', template_name)
|
||||
self.assert_queue_response(mode, '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):
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
def assert_queue_response(self, mode, expected_mode, expected_template_name):
|
||||
"""Dry method for course enrollment and adding request to queue."""
|
||||
CourseEnrollmentFactory(
|
||||
user=self.user_2,
|
||||
course_id=self.course.id,
|
||||
@@ -145,66 +109,19 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
|
||||
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)
|
||||
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
|
||||
self.assertTrue(mock_send.called)
|
||||
__, kwargs = mock_send.call_args_list[0]
|
||||
|
||||
actual_header = json.loads(kwargs['header'])
|
||||
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'])
|
||||
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)
|
||||
|
||||
|
||||
@attr('shard_1')
|
||||
@override_settings(CERT_QUEUE='certificates')
|
||||
|
||||
@@ -71,7 +71,7 @@ class CertificateSupportTestCase(ModuleStoreTestCase):
|
||||
)
|
||||
|
||||
# Create certificates for the student
|
||||
self.cert = GeneratedCertificate.eligible_certificates.create(
|
||||
self.cert = GeneratedCertificate.objects.create(
|
||||
user=self.student,
|
||||
course_id=self.CERT_COURSE_KEY,
|
||||
grade=self.CERT_GRADE,
|
||||
@@ -259,7 +259,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase):
|
||||
# Check that the user's certificate was updated
|
||||
# Since the student hasn't actually passed the course,
|
||||
# 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)
|
||||
|
||||
def test_regenerate_certificate_missing_params(self):
|
||||
@@ -298,7 +298,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase):
|
||||
|
||||
def test_regenerate_user_has_no_certificate(self):
|
||||
# Delete the user's certificate
|
||||
GeneratedCertificate.eligible_certificates.all().delete()
|
||||
GeneratedCertificate.objects.all().delete()
|
||||
|
||||
# Should be able to regenerate
|
||||
response = self._regenerate(
|
||||
@@ -308,7 +308,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# 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)
|
||||
|
||||
def _regenerate(self, course_key=None, username=None):
|
||||
@@ -412,7 +412,7 @@ class CertificateGenerateTests(CertificateSupportTestCase):
|
||||
|
||||
def test_generate_user_has_no_certificate(self):
|
||||
# Delete the user's certificate
|
||||
GeneratedCertificate.eligible_certificates.all().delete()
|
||||
GeneratedCertificate.objects.all().delete()
|
||||
|
||||
# Should be able to generate
|
||||
response = self._generate(
|
||||
@@ -422,7 +422,7 @@ class CertificateGenerateTests(CertificateSupportTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# 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)
|
||||
|
||||
def _generate(self, course_key=None, username=None):
|
||||
|
||||
@@ -210,7 +210,7 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase):
|
||||
self.user.profile.name = "Joe User"
|
||||
self.user.profile.save()
|
||||
self.client.login(username=self.user.username, password='foo')
|
||||
self.cert = GeneratedCertificate.eligible_certificates.create(
|
||||
self.cert = GeneratedCertificate.objects.create(
|
||||
user=self.user,
|
||||
course_id=self.course_id,
|
||||
download_uuid=uuid4(),
|
||||
|
||||
@@ -13,7 +13,6 @@ from django.core.urlresolvers import reverse
|
||||
from django.test.client import Client
|
||||
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 student.tests.factories import UserFactory, CourseEnrollmentFactory
|
||||
from student.roles import CourseStaffRole
|
||||
@@ -97,8 +96,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
|
||||
)
|
||||
CourseEnrollmentFactory.create(
|
||||
user=self.user,
|
||||
course_id=self.course_id,
|
||||
mode=CourseMode.HONOR,
|
||||
course_id=self.course_id
|
||||
)
|
||||
CertificateHtmlViewConfigurationFactory.create()
|
||||
LinkedInAddToProfileConfigurationFactory.create()
|
||||
@@ -380,32 +378,6 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
|
||||
self.assertIn("Cannot Find Certificate", 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)
|
||||
def test_html_view_for_invalid_certificate(self):
|
||||
"""
|
||||
@@ -561,7 +533,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
|
||||
course_id=unicode(self.course.id)
|
||||
)
|
||||
self.cert.delete()
|
||||
self.assertEqual(len(GeneratedCertificate.eligible_certificates.all()), 0)
|
||||
self.assertEqual(len(GeneratedCertificate.objects.all()), 0)
|
||||
|
||||
response = self.client.get(test_url)
|
||||
self.assertIn('invalid', response.content)
|
||||
@@ -584,7 +556,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
|
||||
preview mode. Either the certificate is marked active or not.
|
||||
"""
|
||||
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)
|
||||
test_url = get_certificate_url(
|
||||
user_id=self.user.id,
|
||||
|
||||
@@ -342,7 +342,7 @@ def _get_user_certificate(request, user, course_key, course, preview_mode=None):
|
||||
else:
|
||||
# certificate is being viewed by learner or public
|
||||
try:
|
||||
user_certificate = GeneratedCertificate.eligible_certificates.get(
|
||||
user_certificate = GeneratedCertificate.objects.get(
|
||||
user=user,
|
||||
course_id=course_key,
|
||||
status=CertificateStatuses.downloadable
|
||||
@@ -459,7 +459,7 @@ def render_cert_by_uuid(request, certificate_uuid):
|
||||
This public view generates an HTML representation of the specified certificate
|
||||
"""
|
||||
try:
|
||||
certificate = GeneratedCertificate.eligible_certificates.get(
|
||||
certificate = GeneratedCertificate.objects.get(
|
||||
verify_uuid=certificate_uuid,
|
||||
status=CertificateStatuses.downloadable
|
||||
)
|
||||
|
||||
@@ -75,7 +75,7 @@ def update_certificate(request):
|
||||
try:
|
||||
course_key = SlashSeparatedCourseKey.from_deprecated_string(xqueue_body['course_id'])
|
||||
|
||||
cert = GeneratedCertificate.eligible_certificates.get(
|
||||
cert = GeneratedCertificate.objects.get(
|
||||
user__username=xqueue_body['username'],
|
||||
course_id=course_key,
|
||||
key=xqueue_header['lms_key'])
|
||||
|
||||
@@ -619,7 +619,7 @@ class CertificateExceptionViewInstructorApiTest(SharedModuleStoreTestCase):
|
||||
# Verify that certificate exception successfully removed from CertificateWhitelist and GeneratedCertificate
|
||||
with self.assertRaises(ObjectDoesNotExist):
|
||||
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
|
||||
)
|
||||
|
||||
@@ -1010,7 +1010,7 @@ class CertificateInvalidationViewTests(SharedModuleStoreTestCase):
|
||||
self.fail("The certificate is not invalidated.")
|
||||
|
||||
# Validate generated certificate was invalidated
|
||||
generated_certificate = GeneratedCertificate.eligible_certificates.get(
|
||||
generated_certificate = GeneratedCertificate.objects.get(
|
||||
user=self.enrolled_user_1,
|
||||
course_id=self.course.id,
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
course_id=course_key,
|
||||
status=CertificateStatuses.downloadable,
|
||||
@@ -2912,10 +2912,7 @@ def remove_certificate_exception(course_key, student):
|
||||
)
|
||||
|
||||
try:
|
||||
generated_certificate = GeneratedCertificate.objects.get( # pylint: disable=no-member
|
||||
user=student,
|
||||
course_id=course_key
|
||||
)
|
||||
generated_certificate = GeneratedCertificate.objects.get(user=student, course_id=course_key)
|
||||
generated_certificate.invalidate()
|
||||
except ObjectDoesNotExist:
|
||||
# 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):
|
||||
|
||||
report_run_date = datetime.date.today().strftime("%B %d, %Y")
|
||||
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,
|
||||
status=CertificateStatuses.downloadable
|
||||
).values(*certificate_features).annotate(total_issued_certificate=Count('mode')))
|
||||
|
||||
@@ -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 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,
|
||||
course_id=course_id,
|
||||
status__in=certificate_statuses,
|
||||
|
||||
@@ -1802,7 +1802,7 @@ class TestCertificateGeneration(InstructorTaskModuleTestCase):
|
||||
},
|
||||
result
|
||||
)
|
||||
generated_certificates = GeneratedCertificate.eligible_certificates.filter(
|
||||
generated_certificates = GeneratedCertificate.objects.filter(
|
||||
user__in=students,
|
||||
course_id=self.course.id,
|
||||
mode='honor'
|
||||
@@ -1912,7 +1912,7 @@ class TestCertificateGeneration(InstructorTaskModuleTestCase):
|
||||
result
|
||||
)
|
||||
|
||||
generated_certificates = GeneratedCertificate.eligible_certificates.filter(
|
||||
generated_certificates = GeneratedCertificate.objects.filter(
|
||||
user__in=students,
|
||||
course_id=self.course.id,
|
||||
mode='honor'
|
||||
|
||||
Reference in New Issue
Block a user