openfun / richie

:pencil: An opensource CMS to build education portals
https://richie.education
MIT License
256 stars 80 forks source link

Flag as enrolled to On going products #2361

Closed jbpenrath closed 2 months ago

jbpenrath commented 3 months ago

Bug Report

Problematic Behavior

On a course syllabus, a course run representing a Joanie product the user has not purchased is suffixed by the badge "Enrolled"

image

Expected behavior/code

If the user has not purchased the related product, the badge should not be displayed. Further tests should be done to check if all is working well with simple course run, product purchased, etc...

Steps to Reproduce

  1. Create a product with on going course run on Joanie
  2. Synchronize the product on Richie
  3. BOOM
rlecellier commented 3 months ago

@jbpenrath

I didn't succeed to reproduce and didn't understand who this tag could be displayed without an existing enrollment for the current user.

The tag is displayed in CourseRunItemWithEnrollment when useCourseEnrollment return enrollmentIsActive === true useCourseEnrollment will fetch an existing enrollment and if one is found, it will then fetch if its active.

The only way to have enrollmentIsActive === true is to have an active enrollment in Joanie attached to the resource link of the courseRun.