-
Notifications
You must be signed in to change notification settings - Fork 0
+269
−109
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
johanaam
requested changes
Apr 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things:
- The rule that a pupil can only join a new classroom when they are not active in another classroom is not enforced in the backend.
joinClassroomonly checks whether the pupil is already a member of the target classroom. If this is an important product invariant, the service should guard it explicitly. PupilProfile.currentClassroomandclassroom_pupils.statusnow act as two related sources of truth. The code manually keeps them in sync during approval/removal, which is easy to break later. We should either make the relationship very explicit in the service or derive one from the other where possible.CurrentUserProfileService.findMembership()returns the first active membership anywhere, otherwise the first pending membership anywhere. That meansmembershipStatusmay not describe the same classroom ascurrentClassroomId, which makes the API response ambiguous.ClassroomControllerstill fetches pupil profiles directly when building classroom details. That lookup belongs in the service layer so the controller stays thin.- Some updated tests pre-seed
currentClassroom, which makes it harder to verify that join/approval behavior is actually doing the right thing. It would be better to assert the intended pending and approved states directly.
I got help from Codex finding these.
…m-control # Conflicts: # src/main/kotlin/edu/ntnu/idi/idatt/backend/classroom/application/ClassroomService.kt
Ok, I have updated the join classroom to check whether the pupil has any memberships already, and the findMembership method in CurrentUserProfileService to throw if it finds more than one membership, so there should not be any issues of mismatches between status and classroom, or any pupil joining more than one classroom. I´m not sure which tests you're referring to? If you specify I could update some :) |
sindrelm
approved these changes
Apr 30, 2026
johanaam
approved these changes
Apr 30, 2026
Sign in
to join this conversation on GitHub.
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.
Backend for classroom control, should be merged at the same time as feat: classroom control #69 on frontend to avoid issues for pupils not yet in classroom.