Skip to content

Commit 6430844

Browse files
committed
remove deleted games from session page
1 parent 3cdad39 commit 6430844

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

public/app/sessionController.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ function Session($scope, $http, $location, $interval, $routeParams, SessionServi
1414
// identify new games
1515
gameids = []
1616
for (var i = 0; i < $scope.games.length; i++) {
17-
gameids.push($scope.games[i].id);
17+
// if the game has been removed from the session
18+
if ( !$scope.session.games.includes($scope.games[i].id) ) {
19+
$scope.games.splice(i, 1);
20+
} else {
21+
gameids.push($scope.games[i].id);
22+
}
1823
}
1924
for (var i = 0; i < $scope.session.games.length; i++) {
2025
if ( !gameids.includes($scope.session.games[i]) ) {

0 commit comments

Comments
 (0)