From 61e4193455f10bee8924515591118311dfd5ef2e Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sat, 23 Apr 2022 08:36:21 +0200 Subject: [PATCH] Fix bug in getUsers --- src/server/tmdb.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/server/tmdb.js b/src/server/tmdb.js index 59ca863..885ee94 100644 --- a/src/server/tmdb.js +++ b/src/server/tmdb.js @@ -441,13 +441,16 @@ async function assignFirstMatch(teamId, tournamentId) { function getUsers () { return new Promise(function(resolve, reject) { - connection.query("SELECT * FROM users", (err, users) => { + connection.query("SELECT * FROM users", (err, userRows) => { if (err) { console.log(err); reject(err); } else { - users.forEach((user, index) => { - this[index].isManager = (this[index].isManager == 1); + let users = []; + userRows.forEach((userRow, index) => { + let user = results=JSON.parse(JSON.stringify(userRow)) + user.isManager = user.isManager == 1; + users.push(user); }); resolve(users); }