Skip to content

Class selection on /profile corresponds to CSA/CSP/CSSE/CSH group - #173

Open
adikatre wants to merge 5 commits into
Open-Coding-Society:masterfrom
adikatre:master
Open

Class selection on /profile corresponds to CSA/CSP/CSSE/CSH group#173
adikatre wants to merge 5 commits into
Open-Coding-Society:masterfrom
adikatre:master

Conversation

@adikatre

@adikatre adikatre commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Also:

  • fixed group creation bug on Thymeleaf page
  • Default CSP/CSA/CSH/CSSE groups upon db init

Co-authored-intellectually-by: Nikhil Maturi <code259@users.noreply.github.com>
Co-authored-intellectually-by: Nikhil Maturi <code259@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 25, 2026 17:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ClassGroupMembershipService to normalize selected class names and sync memberships for the four supported course groups.
  • Exposed a new API endpoint PUT /api/groups/class-memberships to 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.

Comment on lines +336 to +341
try {
List<String> memberships = classGroupMembershipService.syncMemberships(
userDetails.getUsername(),
dto.getClasses()
);
return new ResponseEntity<>(Map.of("groups", memberships), HttpStatus.OK);
Comment on lines +531 to +535
name: groupName,
period: groupPeriod,
course: groupCourse,
memberIds: []
})
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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.

2 participants