-
Notifications
You must be signed in to change notification settings - Fork 0
fix: add classroom to pupil profile #44
Conversation
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.
Two codex findings:
Setting profile.currentClassroom during joinClassroom changes the pupil's default classroom before the teacher has approved the membership. CurrentUserResolver.getClassroomByUser() now trusts that field, so a pupil with membershipStatus = PENDING can immediately reach classroom-scoped endpoints such as notebook and medals, and /api/v1/users/me will also switch their XP/level context to the unapproved classroom. Before this patch, a join request did not grant that classroom context.
Once this branch writes currentClassroom on every successful join, removePupil also needs to null it out when the removed pupil's active classroom is the one being deleted. As written, the membership row is removed but the profile still points at the old classroom, and CurrentUserResolver.getClassroomByUser() will keep resolving that classroom for notebook/medal requests even though the pupil is no longer a member.
I can fix these issues on the classroom control update, which i am working on and will be making a couple of backend updates to anyway. This commit is mainly meant to make the classroom creation and joining function correctly. Since you cant approve pupils or delete a classroom yet, i dont think these concerns need to be addressed in this specific update. |
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.
lgtm. some new conflicts now
…fixes # Conflicts: # src/main/kotlin/edu/ntnu/idi/idatt/backend/classroom/application/ClassroomService.kt # src/test/kotlin/edu/ntnu/idi/idatt/backend/classroom/ClassroomServiceTest.kt
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.
lgtm!
No description provided.