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
2fcfeee6
Commit
2fcfeee6
authored
5 years ago
by
ivarnm
Browse files
Options
Downloads
Patches
Plain Diff
#10
Add putRoundScore
parent
276edc9a
No related branches found
No related tags found
1 merge request
!21
Resolve "Query intermediate"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/core/src/com/gameware/game/QueryIntermediate.java
+19
-0
19 additions, 0 deletions
frontend/core/src/com/gameware/game/QueryIntermediate.java
with
19 additions
and
0 deletions
frontend/core/src/com/gameware/game/QueryIntermediate.java
+
19
−
0
View file @
2fcfeee6
...
@@ -43,6 +43,14 @@ public class QueryIntermediate {
...
@@ -43,6 +43,14 @@ public class QueryIntermediate {
return
sendRequest
(
httpPost
);
return
sendRequest
(
httpPost
);
}
}
private
static
String
[]
sendPutRequest
(
String
route
,
Map
<
String
,
String
>
params
)
{
HttpRequest
httpPut
=
new
HttpRequest
(
HttpMethods
.
PUT
);
httpPut
.
setUrl
(
baseUrl
+
route
);
httpPut
.
setHeader
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
httpPut
.
setContent
(
HttpParametersUtils
.
convertHttpParameters
(
params
));
return
sendRequest
(
httpPut
);
}
// Send a request to server and return response code and text
// Send a request to server and return response code and text
private
static
String
[]
sendRequest
(
HttpRequest
request
)
{
private
static
String
[]
sendRequest
(
HttpRequest
request
)
{
final
String
[]
response
=
new
String
[
2
];
final
String
[]
response
=
new
String
[
2
];
...
@@ -224,5 +232,16 @@ public class QueryIntermediate {
...
@@ -224,5 +232,16 @@ public class QueryIntermediate {
return
round
;
return
round
;
}
}
public
static
Round
putRoundScore
(
String
roundId
,
int
score
)
throws
IOException
,
NoSuchElementException
{
String
route
=
"rounds/"
+
roundId
;
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"scoreValue"
,
Integer
.
toString
(
score
));
String
[]
response
=
sendPutRequest
(
route
,
params
);
checkStatusCode
(
response
);
Round
round
=
json
.
fromJson
(
Round
.
class
,
response
[
1
]);
checkObjectNotNull
(
round
);
return
round
;
}
}
}
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