Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Voting
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dennis Willers
Voting
Commits
238b8299
Commit
238b8299
authored
Aug 21, 2021
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Bug with check if vote is a number
parent
1a692230
Pipeline
#429
passed with stages
in 2 minutes and 44 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
events.js
events.js
+5
-3
socket.js
socket.js
+2
-4
No files found.
events.js
View file @
238b8299
...
...
@@ -164,7 +164,7 @@ function createRouter(db) {
if
(
isgetMapInfoValid
(
req
))
{
const
mapId
=
req
.
body
.
mapId
;
const
userId
=
req
.
body
.
userId
;
const
sql
=
'
SELECT vote FROM Vote
v2
WHERE mapId LIKE
\
"
'
+
mapId
+
'
\
" AND userId LIKE
\
"
'
+
userId
+
'
\
";
'
;
const
sql
=
'
SELECT vote FROM Vote WHERE mapId LIKE
\
"
'
+
mapId
+
'
\
" AND userId LIKE
\
"
'
+
userId
+
'
\
";
'
;
console
.
log
(
'
Update Vote:
'
,
sql
);
db
.
query
(
sql
,
...
...
@@ -178,13 +178,15 @@ function createRouter(db) {
if
(
results
.
length
===
1
)
{
vote
=
results
[
0
].
vote
;
}
if
(
vote
)
{
if
(
!
isNaN
(
vote
)
)
{
req
.
body
.
vote
=
vote
;
getMapInfo
(
req
,
res
);
return
;
}
}
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
500
).
json
({
status
:
'
unexpected result in getVote
'
});
}
else
{
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
500
).
json
({
status
:
'
too many results in getVote
'
});
}
}
});
}
else
{
...
...
socket.js
View file @
238b8299
...
...
@@ -242,10 +242,8 @@ const testClient = net.connect({host: 'localhost', port: 3000}, () => {
console
.
log
(
'
connected to server!
'
);
//testClient.write('Hello World Client!\r\n');
testClient
.
write
(
JSON
.
stringify
({
"
mapId
"
:
"
keineBekannteMap1
"
,
"
name
"
:
"
keinBekannterMapName1
"
,
"
userId
"
:
"
keinBekannterUser1
"
,
"
vote
"
:
80
"
mapId
"
:
"
7fsfRSUCQ7YwfBEdRk_GivW6qzj
"
,
"
userId
"
:
"
aKBNg9fbReqLedLiz1KFfA
"
,
"
name
"
:
"
Summer 2021 - 01
"
//"vote": 80
}));
//test(testClient);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment