From cff934388990728f8c4a9da95d00245daad26c16 Mon Sep 17 00:00:00 2001 From: Jonathan Piacenti Date: Tue, 22 Dec 2015 19:06:55 +0000 Subject: [PATCH] Change issuing_component for included badge events. --- lms/djangoapps/badges/api/views.py | 2 +- lms/djangoapps/badges/events/course_meta.py | 4 ++-- .../badges/events/tests/test_course_meta.py | 18 +++++++++--------- .../0003_schema__add_event_configuration.py | 6 +++--- lms/djangoapps/badges/models.py | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lms/djangoapps/badges/api/views.py b/lms/djangoapps/badges/api/views.py index ad91e2b0da..4e99b85f69 100644 --- a/lms/djangoapps/badges/api/views.py +++ b/lms/djangoapps/badges/api/views.py @@ -77,7 +77,7 @@ class UserBadgeAssertions(generics.ListAPIView): { "badge_class": { "slug": "special_award", - "issuing_component": "edx__course", + "issuing_component": "openedx__course", "display_name": "Very Special Award", "course_id": "course-v1:edX+DemoX+Demo_Course", "description": "Awarded for people who did something incredibly special", diff --git a/lms/djangoapps/badges/events/course_meta.py b/lms/djangoapps/badges/events/course_meta.py index a09696a1d0..5b1dd20a87 100644 --- a/lms/djangoapps/badges/events/course_meta.py +++ b/lms/djangoapps/badges/events/course_meta.py @@ -20,7 +20,7 @@ def award_badge(config, count, user): if not slug: return badge_class = BadgeClass.get_badge_class( - slug=slug, issuing_component='edx__course', create=False, + slug=slug, issuing_component='openedx__course', create=False, ) if not badge_class: return @@ -72,7 +72,7 @@ def course_group_check(user, course_key): for slug in awards: badge_class = BadgeClass.get_badge_class( - slug=slug, issuing_component='edx__course', create=False, + slug=slug, issuing_component='openedx__course', create=False, ) if badge_class and not badge_class.get_for_user(user): badge_class.award(user) diff --git a/lms/djangoapps/badges/events/tests/test_course_meta.py b/lms/djangoapps/badges/events/tests/test_course_meta.py index c5c92fe828..d1a79c118f 100644 --- a/lms/djangoapps/badges/events/tests/test_course_meta.py +++ b/lms/djangoapps/badges/events/tests/test_course_meta.py @@ -34,13 +34,13 @@ class CourseEnrollmentBadgeTest(ModuleStoreTestCase): super(CourseEnrollmentBadgeTest, self).setUp() self.badge_classes = [ RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), ] nums = ['3', '5', '8'] @@ -102,13 +102,13 @@ class CourseCompletionBadgeTest(ModuleStoreTestCase): super(CourseCompletionBadgeTest, self).setUp() self.badge_classes = [ RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), ] nums = ['2', '6', '9'] @@ -179,13 +179,13 @@ class CourseGroupBadgeTest(ModuleStoreTestCase): super(CourseGroupBadgeTest, self).setUp() self.badge_classes = [ RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), RandomBadgeClassFactory( - issuing_component='edx__course' + issuing_component='openedx__course' ), ] self.courses = [] diff --git a/lms/djangoapps/badges/migrations/0003_schema__add_event_configuration.py b/lms/djangoapps/badges/migrations/0003_schema__add_event_configuration.py index 557408b913..51b221508f 100644 --- a/lms/djangoapps/badges/migrations/0003_schema__add_event_configuration.py +++ b/lms/djangoapps/badges/migrations/0003_schema__add_event_configuration.py @@ -20,9 +20,9 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')), ('enabled', models.BooleanField(default=False, verbose_name='Enabled')), - ('courses_completed', models.TextField(default=b'', help_text="On each line, put the number of completed courses to award a badge for, a comma, and the slug of a badge class you have created with the issuing component 'edx__course'. For example: 3,enrolled_3_courses", blank=True)), - ('courses_enrolled', models.TextField(default=b'', help_text="On each line, put the number of enrolled courses to award a badge for, a comma, and the slug of a badge class you have created with the issuing component 'edx__course'. For example: 3,enrolled_3_courses", blank=True)), - ('course_groups', models.TextField(default=b'', help_text="Each line is a comma-separated list. The first item in each line is the slug of a badge class to award, with an issuing component of 'edx__course'. The remaining items in each line are the course keys the user will need to complete to be awarded the badge. For example: slug_for_compsci_courses_group_badge,course-v1:CompSci+Course+First,course-v1:CompsSci+Course+Second", blank=True)), + ('courses_completed', models.TextField(default=b'', help_text="On each line, put the number of completed courses to award a badge for, a comma, and the slug of a badge class you have created that has the issuing component 'openedx__course'. For example: 3,enrolled_3_courses", blank=True)), + ('courses_enrolled', models.TextField(default=b'', help_text="On each line, put the number of enrolled courses to award a badge for, a comma, and the slug of a badge class you have created that has the issuing component 'openedx__course'. For example: 3,enrolled_3_courses", blank=True)), + ('course_groups', models.TextField(default=b'', help_text="Each line is a comma-separated list. The first item in each line is the slug of a badge class you have created that has an issuing component of 'openedx__course'. The remaining items in each line are the course keys the learner needs to complete to be awarded the badge. For example: slug_for_compsci_courses_group_badge,course-v1:CompSci+Course+First,course-v1:CompsSci+Course+Second", blank=True)), ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')), ], ), diff --git a/lms/djangoapps/badges/models.py b/lms/djangoapps/badges/models.py index 60847e8ae0..cc076c488a 100644 --- a/lms/djangoapps/badges/models.py +++ b/lms/djangoapps/badges/models.py @@ -220,7 +220,7 @@ class CourseEventBadgesConfiguration(ConfigurationModel): blank=True, default='', help_text=_( u"On each line, put the number of completed courses to award a badge for, a comma, and the slug of a " - u"badge class you have created with the issuing component 'edx__course'. " + u"badge class you have created that has the issuing component 'openedx__course'. " u"For example: 3,enrolled_3_courses" ) ) @@ -228,16 +228,16 @@ class CourseEventBadgesConfiguration(ConfigurationModel): blank=True, default='', help_text=_( u"On each line, put the number of enrolled courses to award a badge for, a comma, and the slug of a " - u"badge class you have created with the issuing component 'edx__course'. " + u"badge class you have created that has the issuing component 'openedx__course'. " u"For example: 3,enrolled_3_courses" ) ) course_groups = models.TextField( blank=True, default='', help_text=_( - u"Each line is a comma-separated list. The first item in each line is the slug of a badge class to award, " - u"with an issuing component of 'edx__course'. The remaining items in each line are the course keys the " - u"user will need to complete to be awarded the badge. For example: " + u"Each line is a comma-separated list. The first item in each line is the slug of a badge class you " + u"have created that has an issuing component of 'openedx__course'. The remaining items in each line are " + u"the course keys the learner needs to complete to be awarded the badge. For example: " u"slug_for_compsci_courses_group_badge,course-v1:CompSci+Course+First,course-v1:CompsSci+Course+Second" ) )