Skip to content

[#13646] Rename default Instructor team and section constants#13683

Open
Nsohko wants to merge 19 commits intoTEAMMATES:masterfrom
Nsohko:sai/rename-inst-sect-const
Open

[#13646] Rename default Instructor team and section constants#13683
Nsohko wants to merge 19 commits intoTEAMMATES:masterfrom
Nsohko:sai/rename-inst-sect-const

Conversation

@Nsohko
Copy link
Copy Markdown
Contributor

@Nsohko Nsohko commented Mar 26, 2026

Fixes #13646

  1. Reserved team and section names
    The system identifiers are fixed to TEAMMATES_RESERVED_INSTRUCTORS (synthetic instructor team in roster/results) and TEAMMATES_RESERVED_DEFAULT_SECTION (default / “no specific section” section).
    The backend now blocks anyone trying to manually create teams / sections with these names
    The old 'reserved' names (Instructors / None) are now allowed

  2. generateTypes and the frontend
    Running ./gradlew generateTypes (via generateApiConstants) refreshes src/web/types/api-const.ts, so the Angular app gets ApiStringConst.DEFAULT_SECTION and ApiStringConst.USER_TEAM_FOR_INSTRUCTOR with the same values as teammates.common.util.Const / ApiStringConst on the server. The UI uses those generated constants for comparisons and labels (e.g. showing “No specific section” when the section key is the default) without duplicating magic strings by hand.

  3. On the frontend, the unique identifiers are converted to human readable 'No Specific Section' and 'Instructors' respectively.
    If a section exists with the name 'No Specific Section', it is displayed as 'No Specific Section (Named Section)' to disambiguate
    Similarly, a team called 'Instructors' is displayed as 'Instructors (Named Team)'

  4. Finished a todo in student-update validation: it now sets the existing student’s id on the Student used for validation before validateSectionsAndTeams, removing the need for temporary email swap that existed only to make batch logic line up, and extends isInEnrollList so a roster row matches the batch by persisted id as well as email—covering single-student updates (including email changes) where the old and new addresses no longer match.

return this.section.isEmpty() ? Const.DEFAULT_SECTION : this.section;
}

/** Section as entered (may be empty); used for reserved-name validation. */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the check to validate method would be sufficient. Check should be done on the FE before they submit the form as well.

Comment on lines +61 to +69
for (StudentsEnrollRequest.StudentEnrollRequest studentEnrollRequest : studentEnrollRequests) {
try {
sqlLogic.validateReservedTeamAndSectionForEnrollment(
studentEnrollRequest.getTeam(),
studentEnrollRequest.getSectionInput());
} catch (EnrollException e) {
throw new InvalidOperationException(e);
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this is necessary. Just validate the inputs should be fine.

I would like the mental model to be "Users cannot set Team and Section name equivalent to the special constants", not "Team and section name cannot be the special constants".

This makes it an input validation concern, not a system one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename default Instructor team and section constants

2 participants