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
d05b1c49
Commit
d05b1c49
authored
5 years ago
by
Tobias Ingebrigt Ørstad
Browse files
Options
Downloads
Plain Diff
Merge branch '95-backend-cleanup' into 'dev'
final fixes to alerts Closes
#95
See merge request
!101
parents
533ff1e0
7ebc49ee
Branches
Branches containing commit
No related tags found
1 merge request
!101
final fixes to alerts
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/api/rounds.js
+1
-1
1 addition, 1 deletion
backend/api/rounds.js
backend/api/tournament.js
+40
-0
40 additions, 0 deletions
backend/api/tournament.js
with
41 additions
and
1 deletion
backend/api/rounds.js
+
1
−
1
View file @
d05b1c49
...
...
@@ -449,7 +449,7 @@ function roundcheck(client, tournament, roundid) {
// fetched the round objects of the active round
let
activePlayer
;
for
(
let
i
=
0
;
i
<
rounds
.
length
;
i
++
)
{
if
(
rounds
[
i
].
_id
.
str
==
roundid
.
str
)
{
if
(
String
(
rounds
[
i
].
_id
)
==
String
(
roundid
)
)
{
activePlayer
=
rounds
[
i
].
playerId
;
break
;
}
...
...
This diff is collapsed.
Click to expand it.
backend/api/tournament.js
+
40
−
0
View file @
d05b1c49
...
...
@@ -309,6 +309,46 @@ router.get("/playeractive/:userid", (req, res) => {
);
});
router
.
get
(
"
/specific/:id
"
,
(
req
,
res
)
=>
{
MongoClient
.
connect
(
connectionUrl
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
},
(
err
,
client
)
=>
{
// Unable to connect to database
if
(
err
)
{
res
.
sendStatus
(
500
);
// Internal server error
return
;
}
let
id
;
if
(
!
req
.
params
.
id
)
{
res
.
sendStatus
(
400
);
}
try
{
id
=
mongo
.
ObjectID
(
req
.
params
.
id
);
}
catch
(
err
)
{
res
.
sendStatus
(
400
);
}
// Using the database gameWare and collection tournaments
const
db
=
client
.
db
(
"
gameWare
"
);
const
collection
=
"
tournaments
"
;
db
.
collection
(
collection
)
.
find
({
_id
:
id
,
})
.
toArray
((
err
,
result
)
=>
{
if
(
err
)
{
res
.
sendStatus
(
500
);
client
.
close
();
return
;
}
res
.
json
(
result
[
0
]);
client
.
close
();
});
}
);
});
router
.
get
(
"
/player/:userid/:active
"
,
(
req
,
res
)
=>
{
// Returns the tournaments of player with active field matching parameter
// Also checks the state of all tournaments
...
...
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