Skip to content

Commit

Permalink
Merge pull request #407 from edly-io/farhan/EDLY-5860
Browse files Browse the repository at this point in the history
Badgr Flow on Panel FE  EDLY-5860
  • Loading branch information
mfarhan943 authored Aug 17, 2023
2 parents ba357fa + aefd959 commit 1a4eda7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@
'DEFAULT_FROM_EMAIL', 'BULK_EMAIL_DEFAULT_FROM_EMAIL',
'FEATURES', 'MKTG_URLS', 'MARKETING_SITE_ROOT',
'CORS_ORIGIN_WHITELIST', 'CURRENT_PLAN', 'LMS_SEGMENT_KEY', 'CMS_SEGMENT_KEY', 'BADGR_USERNAME', 'BADGR_PASSWORD',
'BADGR_ISSUER_SLUG',
'BADGR_ISSUER_SLUG', 'ENABLE_OPENBADGES',
]

# CORS CONFIG
Expand Down
3 changes: 2 additions & 1 deletion lms/djangoapps/badges/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class BadgeClassSerializer(serializers.ModelSerializer):

class Meta(object):
model = BadgeClass
fields = ('slug', 'issuing_component', 'display_name', 'course_id', 'description', 'criteria', 'image_url')
fields = ('slug', 'issuing_component', 'display_name', 'course_id', 'description', 'criteria', 'image_url',
'mode', 'badgr_server_slug')


class BadgeAssertionSerializer(serializers.ModelSerializer):
Expand Down
3 changes: 2 additions & 1 deletion lms/djangoapps/badges/events/course_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def get_completion_badge(course_id, user):
course_id=course_id,
mode=mode,
display_name=course.display_name,
image_file_handle=CourseCompleteImageConfiguration.image_for_mode(mode)
image_file_handle=CourseCompleteImageConfiguration.image_for_mode(mode),
create=False
)


Expand Down
7 changes: 6 additions & 1 deletion lms/djangoapps/certificates/views/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,12 @@ def _update_badge_context(context, course, user):
"""
badge = None
if badges_enabled() and course.issue_badges:
badges = get_completion_badge(course.location.course_key, user).get_for_user(user)
completion_badge = get_completion_badge(course.location.course_key, user)
if completion_badge is not None:
badges = completion_badge.get_for_user(user)
else:
badges = None

if badges:
badge = badges[0]
context['badge'] = badge
Expand Down
2 changes: 1 addition & 1 deletion lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
'REGISTRATION_EXTRA_FIELDS',
'CSRF_TRUSTED_ORIGINS', 'CORS_ORIGIN_WHITELIST', 'CURRENT_PLAN',
'LMS_SEGMENT_KEY', 'CMS_SEGMENT_KEY', 'BADGR_USERNAME', 'BADGR_PASSWORD',
'BADGR_ISSUER_SLUG',
'BADGR_ISSUER_SLUG', 'ENABLE_OPENBADGES',
]

ENABLE_SUBSCRIPTIONS_ON_RUNTIME_SWITCH = 'enable_subscriptions'
Expand Down

0 comments on commit 1a4eda7

Please sign in to comment.