redirect course and script overview pages to add the teacher's most recent section_id #24546
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
line item from spec: https://docs.google.com/document/d/17X2bEVK4YO4gymmVEzAnDYCYTjE5xHQTlDSAZbEprTo/edit#bookmark=id.ljdodx5zi2wn
The idea is to always show a selected section on the course and script overview pages when possible.
Description
If a request from a teacher with sections is made for a course or script overview page without a section_id in the url, perform a redirect which keeps the same url path but replaces the query string with a
?section_id=
referring to the id of their most recently created section.Caveats
In theory if we had other url params, this solution would not be great because we would clobber them. However the only other url params I am aware of on these paths at this time are the ones developers use to enable/disable experiments, so I'm inclined to say YAGNI and deal with preserving the query strong if and when it becomes necessary. If there's a simple way to do this that I'm missing, I don't mind adding it now though.
There are other places, such as script levels, where a teacher might have other url params, such as when they are viewing the level as one of their students. We do not plan to add a default section id in that situation, so we don't have to worry about this solution being generalized to that case.