Today, I have course homepages, generated from the database, working. Additionally, the side menu is populated by courses that the user is enrolled- in/related-to. The links really work, and take you to the course’s homepage.
I moved all the code that does SQL queries into a DatabaseHelpers module. This makes things significantly cleaner, but there’s probably more I can do on the refactoring front.
I need to improve the failure handling of the database code. Currently, I have
error
in a few places, and those function should definitely be using Maybe
return types instead. This requires failure handling all the way back up to
the page template level, so that it can do something appropriate when some
expected database value is not found.
The pages should handle generic failures to find the thing they requested in the database because the appropriate response really depends on the page: class_names can just be empty if they’re not enrolled, but a course homepage without the course should display an appropriate error message.