MIT-LCP / physionet-build

The new PhysioNet platform.
https://physionet.org/
BSD 3-Clause "New" or "Revised" License
56 stars 20 forks source link

Updating the Certification Page for course based trainings #2223

Open Rutvikrj26 opened 5 months ago

Rutvikrj26 commented 5 months ago

What

This is a small PR making a tiny change in the queryset for the trainings. The logic is updated to also include custom logic for courses as their expiry is determined in slightly different way than the regular one.

Why

A TrainingType can have multiple courses attached to it, each being a unique version in itself. Each course version should have it's own valid duration - and hence it's own expiry date.

Whenever a user takes an on-platform course, it is the latest version of the course available at that time, but with time new versions can come in, and at some point, the version of the course that this training was attached to, will be deprecated. At that point all the trainings associated with this course version should be renewed. Thus, admin panel provides an option to set an expiry date to the associated trainings when deprecating a course version. That is how the expiry date for the trainings is decided for course version, which is different from the way it is determined for other types of trainings.

Thus, this PR adds onto the logic of querysets so that all the courses are accurately identified and put under active / expired versions.

This PR does not disturb the regular flow - it only add onto the logic to also fetch the course based trainings (A feature in the upcoming Trainings part-2 PR)

Rutvikrj26 commented 5 months ago

The model connection between Course and Trainings has now been updated to a one-to-many relationship. The initial plan of implementing the M2M was to avoid adding new fields to training. For example, the training_type is attached to course via a foreign key in course, thereby not changing the training_type model, but was not the best implementation and has hence been changed to the more logical implementation - one training can only have one course, but a course can have multiple trainings.

That implementation requires a migration and a new table to be created, which is created in the #1951. This PR should only be merged after merging #1951 else it will break the current Certifications Page

Rutvikrj26 commented 1 month ago

@tompollard @bemoody

When a user is taking a course, we only add a training in the system at the end of the course. The training directly gets to the Accepted stage. To show the courses in progress, I am thinking of making a training object at the start of the course and assign it the review status. When the user completes the course, that training object's status gets updated to Accepted.

Furthermore, I'm also thinking of changing the Under Review to In Progress in the certifications page. Please let me know your thoughts on this.

image

Rutvikrj26 commented 1 week ago

@tompollard @bemoody I've tried summarizing the larger goal & the smaller chunks the entire Course functionality was broken into #2299

This is the third part of the functionality required to display the in-progress, active & expired courses.