Skip to content

Commit

Permalink
feat!: add badgr settings, make badges and courses independent incase…
Browse files Browse the repository at this point in the history
… of courses
  • Loading branch information
Muhammad Faraz Maqsood authored and Muhammad Faraz Maqsood committed Jan 10, 2024
1 parent 7174b64 commit 6789cef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lms/djangoapps/badges/events/course_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,4 @@ def course_badge_check(user, course_key):
LOGGER.info("Completion badge already exists for this user on this course.")
# Badge already exists. Skip.
return
evidence = evidence_url(user.id, course_key)
badge_class.award(user, evidence_url=evidence)
badge_class.award(user)
8 changes: 4 additions & 4 deletions lms/djangoapps/certificates/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from lms.djangoapps.badges.events.course_meta import completion_check, course_group_check
from lms.djangoapps.certificates.data import CertificateStatuses
from lms.djangoapps.instructor_task.models import InstructorTask
from openedx.core.djangoapps.signals.signals import COURSE_CERT_AWARDED, COURSE_CERT_CHANGED, COURSE_CERT_REVOKED
from openedx.core.djangoapps.signals.signals import COURSE_CERT_AWARDED, COURSE_CERT_CHANGED, COURSE_CERT_REVOKED, COURSE_GRADE_NOW_PASSED
from openedx.core.djangoapps.xmodule_django.models import NoneToEmptyManager
from openedx.features.name_affirmation_api.utils import get_name_affirmation_service

Expand Down Expand Up @@ -1235,13 +1235,13 @@ class Meta:
app_label = "certificates"


@receiver(COURSE_CERT_AWARDED, sender=GeneratedCertificate)
@receiver(COURSE_GRADE_NOW_PASSED, dispatch_uid="new_passing_learner")
# pylint: disable=unused-argument
def create_course_badge(sender, user, course_key, status, **kwargs):
def create_course_badge(sender, user, course_id, **kwargs):
"""
Standard signal hook to create course badges when a certificate has been generated.
"""
course_badge_check(user, course_key)
course_badge_check(user, course_id)


@receiver(COURSE_CERT_AWARDED, sender=GeneratedCertificate)
Expand Down

0 comments on commit 6789cef

Please sign in to comment.