You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our database, a Trainee has a training route, which is defined as an integer. We have text values for each of those integers, which we use in the code. These constants, and many others related to them like ROUTE_INITIATIVES are defined in an initialiser called training_routes.
We also have a library class called TrainingRouteManager, which is responsible for answering questions like requires_schools?, requires_degree? etc.
Proposal
Change the training_route column in the database to be a string type instead of an integer type. This will remove the need for any mapping with integers, both on our side and on the data side.
Move any constants around training routes out of the initialiser and into the Trainee model. This seems like the best place, since the routes are the Trainee's responsibility. We could have a concern on Trainee which has all of these constants, the enum definition itself and any other related logic.
Change references to constants like TRAINING_ROUTE_ENUMS to Trainee::training_routes or something similar.
Use the enum convenience methods in place of the TrainingRouteManager where possible.
What We Currently Have
In our database, a Trainee has a training route, which is defined as an integer. We have text values for each of those integers, which we use in the code. These constants, and many others related to them like
ROUTE_INITIATIVES
are defined in an initialiser called training_routes.We also have a library class called TrainingRouteManager, which is responsible for answering questions like
requires_schools?
,requires_degree?
etc.Proposal
TRAINING_ROUTE_ENUMS
toTrainee::training_routes
or something similar.The text was updated successfully, but these errors were encountered: