Removed excess logging, allowed tournament create
This commit is contained in:
parent
eb70ef67b5
commit
cd83a4944a
|
@ -356,10 +356,10 @@ api.post("/team/:teamId/edit", (req, res) => {
|
|||
|
||||
//Takes JSON body
|
||||
api.post("/tournament/create", async (req, res) => {
|
||||
if (!(await isManager(req.session))) {
|
||||
res.json({"status": "error", "data": "Not authorized"});
|
||||
return
|
||||
}
|
||||
// if (!(await isManager(req.session))) {
|
||||
// res.json({"status": "error", "data": "Not authorized"});
|
||||
// return
|
||||
// }
|
||||
//Check that req body is valid
|
||||
if (req.body.name == undefined || req.body.name == "") {
|
||||
res.json({"status": "error", "data": "No data supplied"});
|
||||
|
|
|
@ -420,14 +420,11 @@ async function assignFirstMatch(teamId, tournamentId) {
|
|||
let matches = await getMatchesByTournamentId(tournamentId);
|
||||
|
||||
let highTier = Math.log2(tournament.teamLimit)-1;
|
||||
console.log(highTier);
|
||||
let highTierMatches = matches.filter(match => match.tier == highTier);
|
||||
console.log(matches);
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
for (let match of highTierMatches) {
|
||||
if (match.team1Id == null) {
|
||||
console.log("Assigning team " + teamId + " to match " + match.id + " as team 1");
|
||||
connection.query("UPDATE matches SET team1Id = ? WHERE id = ?", [escapeString(teamId), escapeString(match.id)], (err, sets) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
@ -438,7 +435,6 @@ async function assignFirstMatch(teamId, tournamentId) {
|
|||
});
|
||||
return
|
||||
} else if (match.team2Id == null) {
|
||||
console.log("Assigning team " + teamId + " to match " + match.id + " as team 2");
|
||||
connection.query("UPDATE matches SET team2Id = ? WHERE id = ?", [escapeString(teamId), escapeString(match.id)], (err, sets) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
|
Loading…
Reference in New Issue