Skip to content

Commit aba67dc

Browse files
committed
Bugfix for correct hand raised users when entering a room
1 parent f739d2b commit aba67dc

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

backend/src/main/java/urjc/ovteaching/rooms/controllers/RoomController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ public ResponseEntity<List<JSONObject>> getRaisedHands(@PathVariable String room
287287
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
288288
}
289289
if (room.isInRoom(user)) {
290+
this.roomServ.checkConnectedHandRaisedUsers(room);
291+
this.roomServ.save(room);
290292
return new ResponseEntity<>(room.getHandRaisedUsers(), HttpStatus.OK);
291293
} else {
292294
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);

frontend/src/app/video-room/video-room.component.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,15 +724,24 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
724724
this.localUsers[0].setPositionInHandRaiseQueue(localUserPosition-1);
725725
}
726726
}
727-
this.handsRaisedMessage = (this.handsRaised.length>1 ? 'And ' + (this.handsRaised.length-1) + ' other ' + (this.handsRaised.length===2 ? 'person' : 'people') + ' are' : 'Is') + ' raising their hand'
727+
this.handsRaisedMessage = (this.handsRaised.length>1 ? 'And ' + (this.handsRaised.length-1) + ' other ' + (this.handsRaised.length===2 ? 'person' : 'people') + ' are' : 'Is') + ' raising their hand';
728728
}
729729

730730
private overrideHandRaisedUsers() {
731731
this.roomService.getHandRaisedUsers(this.mySessionId).subscribe(
732732
(users) => {
733-
users.forEach((user, index) => {
734-
this.handsRaised[index] = user;
735-
});
733+
let index = 0;
734+
for(let user of users) {
735+
if(user.nickname!==this.userService.user.name) {
736+
this.handsRaised[index] = user;
737+
if(this.handsRaised.length==1) {
738+
this.playAudio('handRaise');
739+
this.recalculatePopupOffsets();
740+
}
741+
index++;
742+
}
743+
}
744+
this.handsRaisedMessage = (this.handsRaised.length>1 ? 'And ' + (this.handsRaised.length-1) + ' other ' + (this.handsRaised.length===2 ? 'person' : 'people') + ' are' : 'Is') + ' raising their hand';
736745
},
737746
error => console.log(error)
738747
);

0 commit comments

Comments
 (0)