The options for a class's difficulty is set by the global "teacherreg_difficulty_choices" tag. This tag is basically an ordered dictionary consisting of rankings/abbreviations (keys) and their descriptions (values). During class creation/editing, only the descriptions are shown, but the chosen key is saved as a string. This key is then shown on the course catalog and during student registration. However, this presents several problems:
The difficulty description is never shown outside of teacher registration (as far as I can tell). This means that students can only infer what the difficulty is based on the abbreviation. The default for this is some number of stars, but it's unclear to students how many stars is the max, etc.
When the choices tag is changed, this can possibly invalidate all course registration forms because the old chosen strings are no longer valid options. This similarly causes the difficulty filter on the course catalog to break (because the new options that are populated into the filter dropdown don't match the strings in the catalog).
I'm not too sure what the fix for this should be. Here are some possible options:
We could have "difficulty option" model objects like we have flag categories which can be added and removed to individual programs? They would need to have an order such that they are listed in order in the course reg form and catalog filter dropdowns. But how do we backport this behavior to existing difficulty settings for existing classes? We could find all unique difficulty strings and add those as objects in a migration?
We could force the tag to just be a list, but then we save the list index for the difficulty field. When we render the course in the catalog, we use the value at that list index. Unfortunately, this doesn't completely solve the tag change issues because the tag length could be shortened, causing the same problems. This would also have the problem related to backporting.
Maybe we are fine with the current behavior regarding invalidating the reg form, and all we really need to fix is the catalog filter? Instead of using the choices tag, we could pull all unique difficulties from the classes in the catalog (although the entire page is cached which could be an issue), then just sort them alphanumerically? Although this still presents the issue where descriptions are never shown to students.
The options for a class's difficulty is set by the global "teacherreg_difficulty_choices" tag. This tag is basically an ordered dictionary consisting of rankings/abbreviations (keys) and their descriptions (values). During class creation/editing, only the descriptions are shown, but the chosen key is saved as a string. This key is then shown on the course catalog and during student registration. However, this presents several problems:
I'm not too sure what the fix for this should be. Here are some possible options: