Skip to content

Commit

Permalink
bruh
Browse files Browse the repository at this point in the history
  • Loading branch information
appventure-ci authored May 20, 2023
1 parent 899b62c commit f7bc66a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions server/src/database/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export async function registerUser(email: string, name: string, group: Group) {
return;
}

export async function getUserTeam(email: string): Promise<null | Group> {
export async function getUserTeam(email: string): Promise<undefined | Group> {
if (connection == null) {
return null;
return undefined;
}
const query = `select team from users where email=$1`
const values = [email];
const res = await connection.query(query, values);
if (res.rows.length == 0) {
return null;
return undefined;
} else {
return res.rows[0].team;
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ io.on("connection", (socket) => {
// socket.data.group = 2;
// }
socket.data.group = await getUserTeam(unique_name);
if (socket.data.group == null) {
if (!socket.data.group) {
socket.data.group = Math.random() > 0.5 ? 2 : 1;
}
} else {
Expand Down

0 comments on commit f7bc66a

Please sign in to comment.