DFE-Digital/publish-teacher-training

Course status is overly-complicated and multi-dimensional

misaka opened this issue · 4 comments

Currently the status for a Course is hard to reason through as it's multi-dimensional (relies on content_status and ucas_status, which in turn are dynamically calculated from multiple other sources). This means to reason what state a course is, and what it means, we have to hold way too much context in our head, and makes working on anything related to a course's status (e.g. the displayed status in the courses table).

One potential fix for this is to add a state machine to the course model, and to use that to define the states a course can be in, with all the appropriate transitions, on-transition actions, guards, state validations, etc.

fofr commented

From 2020-2021, ucas_status can be derived from content_status.

Last cycle content status and UCAS status were separate because of two places you could publish – on UCAS to put a course live, and on Publish to put content on Find.
Those two things are now one: You put a course onto Find and UCAS by hitting Publish.
So ucas_status ought to be removed.

fofr commented

The idea was that a course status new/draft/published/withdrawn which could cascade to the UCAS status – running/not running/suspended – which in turn cascades to the sites attached to the course. The exception being a site that's attached but removed from a course, which must independently show as suspended.

UCAS status could be completely removed, so the course status cascades directly to sites for the API 🤔

defong commented

stale