Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create badge class on passing a course instead of certificate preview or generation #475

Open
wants to merge 1 commit into
base: sdaia-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading