Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Progark gruppe 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Ingebrigt Ørstad
Progark gruppe 3
Commits
b76fd9a7
Commit
b76fd9a7
authored
5 years ago
by
Tobias Ørstad
Browse files
Options
Downloads
Patches
Plain Diff
Made sure players can only join tournaments that have not gone past the starttime
parent
7ebc49ee
No related branches found
No related tags found
2 merge requests
!104
Dev
,
!103
Made sure players can only join tournaments that have not gone past the starttime
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/api/tournament.js
+13
-0
13 additions, 0 deletions
backend/api/tournament.js
with
13 additions
and
0 deletions
backend/api/tournament.js
+
13
−
0
View file @
b76fd9a7
...
@@ -220,6 +220,8 @@ router.post("/join", (req, res) => {
...
@@ -220,6 +220,8 @@ router.post("/join", (req, res) => {
active
:
true
,
active
:
true
,
// the array of players cannot already contain the player
// the array of players cannot already contain the player
players
:
{
$nin
:
[
playerId
]
},
players
:
{
$nin
:
[
playerId
]
},
// we dont want tournaments that have gone past their starttime
startTime
:
{
$gte
:
new
Date
()
},
},
},
// Add the player to the array
// Add the player to the array
{
{
...
@@ -500,6 +502,17 @@ function roundcheck(client, tournament) {
...
@@ -500,6 +502,17 @@ function roundcheck(client, tournament) {
//if there are less then two people left in the first round, or zero people left in the first round
//if there are less then two people left in the first round, or zero people left in the first round
//the tournament ends
//the tournament ends
}
}
if
(
rounds
.
length
>
0
)
{
// If there is only one player in the tournaments first round and the starttime
// has expired, we end the tournament
if
(
left
.
length
<
2
&&
active
==
1
&&
new
Date
(
start
)
<
new
Date
()
)
{
end
=
true
;
}
}
functions
functions
.
timeOut
(
client
,
tournament
,
timedOut
,
timedOutRounds
)
.
timeOut
(
client
,
tournament
,
timedOut
,
timedOutRounds
)
.
then
(
.
then
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment