Skip to content

BC-10770 - update secondarySchools of guest teachers when a room is deleted#6073

Open
sebmue-dataport wants to merge 17 commits intomainfrom
bc-10770-clear-secondaryschools
Open

BC-10770 - update secondarySchools of guest teachers when a room is deleted#6073
sebmue-dataport wants to merge 17 commits intomainfrom
bc-10770-clear-secondaryschools

Conversation

@sebmue-dataport
Copy link
Contributor

Description

Guest teachers who are invited to rooms on different schools have the school id added to their list of secondary schools. When removing a guest teacher from a room that list was updated correctly (removing the school id). When deleting the room that did not happen.

Links to Tickets or other pull requests

BC-10770

Changes

  • When a room is deleted the secondary schools of guest teachers in that room are updated

Approval for review

  • DEV: If api was changed - generate-client:server was executed in vue frontend and changes were tested and put in a PR with the same branch name.
  • QA: In addition to review, the code has been manually tested (if manual testing is possible)
  • All points were discussed with the ticket creator, support-team or product owner. The code upholds all quality guidelines from the PR-template.

@sebmue-dataport sebmue-dataport marked this pull request as ready for review February 2, 2026 13:41
export class Migration20260130082056 extends Migration {
public async up(): Promise<void> {
const usersToUpdate = await this.getCollection('users')
.aggregate<UserWithSecondarySchools>([
Copy link
Contributor

@hoeppner-dataport hoeppner-dataport Feb 4, 2026

Choose a reason for hiding this comment

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

After:

  1. seeding my database
  2. adding a teacher to a room of another school and
  3. executing the aggregation
    I get a result that contains this teachers secondary school being removed... which is wrong.

Reason for this is that secondarySchools not only contains schoolIds, but also roleIds to differentiate which guest-role the person has at that school.
$setDifference: ['$secondarySchools', '$activeSecondarySchools'], will therefore always contain all secondarySchools.

The query needs to be adapted to not include valid entries for secondarySchool.

Also the update would write only schoolIds into the secondarySchools field... but the roles should be untouched.

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

export class Migration20260130082056 extends Migration {
public async up(): Promise<void> {
const usersToUpdate = await this.getCollection('users')
.aggregate<UserWithSecondarySchools>([
Copy link
Contributor

Choose a reason for hiding this comment

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

fixed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants