Skip to content

feat: generate certificate of completion on course completion - #880

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
oladev2026-tech:feat/certificate-on-course-completion-833
Jul 26, 2026
Merged

feat: generate certificate of completion on course completion#880
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
oladev2026-tech:feat/certificate-on-course-completion-833

Conversation

@oladev2026-tech

Copy link
Copy Markdown
Contributor

closes #833

Overview

When a user completed all lessons in a course, COURSE_COMPLETED was 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 where COURSE_COMPLETED is tracked), it now calls certificateService.generateCertificate(course.id, course.title). A certificateRequestedRef guard ensures the certificate is requested only once per completion, avoiding duplicates from re-renders.

Acceptance criteria

  • Certificate generated on course completion ✅ (requested immediately when the COURSE_COMPLETED condition fires)
  • Best-effort and non-blocking ✅

Scope note

Kept intentionally small per the requested scope — this covers the core gap (certificate generation was never triggered). The dedicated CertificateScreen with 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.

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.
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 5741eff into rinafcode:main Jul 26, 2026
1 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Certificate of completion not triggered after course completion event

2 participants