feat: generate certificate of completion on course completion - #880
Merged
RUKAYAT-CODER merged 1 commit intoJul 26, 2026
Conversation
Add a small certificateService that requests a certificate from the backend, and trigger it from MobileCourseViewer when a course reaches 100% (right where COURSE_COMPLETED is tracked). A ref guard ensures the certificate is requested only once per completion, and the service swallows errors so it never blocks the completion flow.
|
@oladev2026-tech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Thank you for contributing to the project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #833
Overview
When a user completed all lessons in a course,
COURSE_COMPLETEDwas tracked but no certificate was ever requested. This wires certificate generation into the completion flow.Changes
src/services/certificateService.ts(new):certificateService.generateCertificate(courseId, courseTitle?)requests a certificate of completion from the backend (POST /api/certificates/generate). It's best-effort — failures are logged and swallowed so certificate generation never blocks the completion flow.src/components/mobile/MobileCourseViewer.tsx: when a course reaches 100% (right whereCOURSE_COMPLETEDis tracked), it now callscertificateService.generateCertificate(course.id, course.title). AcertificateRequestedRefguard ensures the certificate is requested only once per completion, avoiding duplicates from re-renders.Acceptance criteria
COURSE_COMPLETEDcondition fires)Scope note
Kept intentionally small per the requested scope — this covers the core gap (certificate generation was never triggered). The dedicated
CertificateScreenwith the in-app preview and share button is a natural follow-up on top of this service. I did not run tests or a build locally.