It'd be great to generalize these templates somehow to reduce the copypasta, at very least between search result and course detail. I'm not sure how to generalize the table setup across both note and course, but they really do effectively the same thing. It might be nice to generate headers dynamically based on the model, then we don't have to deal with fixing this in 2-4 places anytime we need to make a fix.
I violated the DRY principle, and now we all suffer.
So this would need to know if there are any notes: https://github.com/FinalsClub/karmaworld/blob/932221c1dba903ec37be8a888f67f127bf100791/karmaworld/templates/courses/course_detail.html#L177-L184
That could be checked against note_set (as seen a few lines below at https://github.com/FinalsClub/karmaworld/blob/932221c1dba903ec37be8a888f67f127bf100791/karmaworld/templates/courses/course_detail.html#L186)
We'll need to do the same thing, separately, with the search results (b/c I made dirty dirty copypasta): https://github.com/FinalsClub/karmaworld/blob/932221c1dba903ec37be8a888f67f127bf100791/karmaworld/templates/notes/search_results.html#L138-L145
For consistency, since it is possible (even if implausible), we ought to make sure the course list behaves the same way when there are no courses (comparing against
object_list
) https://github.com/FinalsClub/karmaworld/blob/932221c1dba903ec37be8a888f67f127bf100791/karmaworld/templates/courses/course_list.html#L95-L106It'd be great to generalize these templates somehow to reduce the copypasta, at very least between search result and course detail. I'm not sure how to generalize the table setup across both note and course, but they really do effectively the same thing. It might be nice to generate headers dynamically based on the model, then we don't have to deal with fixing this in 2-4 places anytime we need to make a fix.
I violated the DRY principle, and now we all suffer.