Skip to content
Permalink
Browse files

Change behaviour when adding a user to a session BT#14882

There's only one action that will be done, only add new users.
The old behaviour that implied add and remove users still exists
in the unused file "add_edit_users_to_session.php"

It requires some tests and validations.
  • Loading branch information...
jmontoyaa committed Sep 28, 2018
1 parent 03aeb0b commit ac72f87b03900dc40fe463b169f8565d29f9114e
@@ -2121,24 +2121,10 @@ public static function subscribeUsersToSession(
}
// update number of users in the session
$nbr_users = count($userList);
if ($empty_users) {
// update number of users in the session
$sql = "UPDATE $tbl_session SET nbr_users= $nbr_users
WHERE id = $sessionId ";
Database::query($sql);
} else {
if ($registerUsersToAllCourses) {
$sql = "UPDATE $tbl_session SET nbr_users = nbr_users + $nbr_users
WHERE id = $sessionId";
Database::query($sql);
} else {
$sql = "UPDATE $tbl_session
SET nbr_users = (SELECT count(user_id) FROM $tbl_session_rel_user WHERE session_id = $sessionId)
WHERE id = $sessionId";
Database::query($sql);
}
}
$sql = "UPDATE $tbl_session
SET nbr_users = (SELECT count(user_id) FROM $tbl_session_rel_user WHERE session_id = $sessionId)
WHERE id = $sessionId";
Database::query($sql);
}
/**

0 comments on commit ac72f87

Please sign in to comment.
You can’t perform that action at this time.