Class selection on /profile corresponds to CSA/CSP/CSSE/CSH group - #173
Class selection on /profile corresponds to CSA/CSP/CSSE/CSH group#173adikatre wants to merge 5 commits into
Conversation
Co-authored-intellectually-by: Nikhil Maturi <code259@users.noreply.github.com>
Co-authored-intellectually-by: Nikhil Maturi <code259@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a99cfa35d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| throw new Error(responseBody.error || `Failed to create group (HTTP ${response.status})`); | ||
| } | ||
|
|
||
| bootstrap.Modal.getOrCreateInstance(document.getElementById("createGroupModal")).hide(); |
There was a problem hiding this comment.
Use a modal API supported by Bootstrap 5.0.2
When group creation succeeds, this page's Bootstrap 5.0.2 bundle does not provide Modal.getOrCreateInstance, so this line throws before location.reload(). The catch block then reports an error even though the server already created the group, and retrying produces a duplicate-name conflict; use the existing 5.0-compatible modal instance API or reload directly.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR adds backend support for syncing a user’s membership in the CSA/CSP/CSH/CSSE course groups based on a set of selected classes, and updates the Group Management Thymeleaf UI to improve group creation behavior.
Changes:
- Added
ClassGroupMembershipServiceto normalize selected class names and sync memberships for the four supported course groups. - Exposed a new API endpoint
PUT /api/groups/class-membershipsto trigger membership synchronization for the authenticated user. - Updated
group.html’s “Create Group” modal to use a proper<form>submit flow, add a “Course” field, and improve error display; added unit tests for the new membership sync service.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/test/java/com/open/spring/mvc/groups/ClassGroupMembershipServiceTest.java | Adds unit tests validating membership sync behavior, error cases, and supported class mapping. |
| src/main/resources/templates/group/group.html | Fixes/improves group creation UI flow and payload; adds course field and inline error display. |
| src/main/java/com/open/spring/mvc/groups/GroupsApiController.java | Adds PUT /class-memberships endpoint and DTO to drive course-group membership sync. |
| src/main/java/com/open/spring/mvc/groups/ClassGroupMembershipService.java | Implements the core normalization + membership sync logic for CSA/CSP/CSH/CSSE groups. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| try { | ||
| List<String> memberships = classGroupMembershipService.syncMemberships( | ||
| userDetails.getUsername(), | ||
| dto.getClasses() | ||
| ); | ||
| return new ResponseEntity<>(Map.of("groups", memberships), HttpStatus.OK); |
| name: groupName, | ||
| period: groupPeriod, | ||
| course: groupCourse, | ||
| memberIds: [] | ||
| }) |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Also: