Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
CTF
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grzegorz
CTF
Commits
cb3c2b61
Commit
cb3c2b61
authored
Apr 10, 2016
by
Grzegorz Pietrusza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
points stub
parent
5e4bf875
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
Flag.java
...main/java/com/telephoners/krakyournet/ctf/beans/Flag.java
+4
-0
SolutionsRepository.java
...ers/krakyournet/ctf/repositories/SolutionsRepository.java
+5
-4
SolutionsResource.java
...ephoners/krakyournet/ctf/resources/SolutionsResource.java
+1
-1
No files found.
service/src/main/java/com/telephoners/krakyournet/ctf/beans/Flag.java
View file @
cb3c2b61
package
com
.
telephoners
.
krakyournet
.
ctf
.
beans
;
package
com
.
telephoners
.
krakyournet
.
ctf
.
beans
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
public
class
Flag
{
public
class
Flag
{
private
String
value
;
private
String
value
;
private
String
description
;
private
String
description
;
...
@@ -14,10 +16,12 @@ public class Flag {
...
@@ -14,10 +16,12 @@ public class Flag {
this
.
points
=
points
;
this
.
points
=
points
;
}
}
@JsonIgnore
public
String
getValue
()
{
public
String
getValue
()
{
return
value
;
return
value
;
}
}
@JsonIgnore
public
void
setValue
(
String
value
)
{
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
this
.
value
=
value
;
}
}
...
...
service/src/main/java/com/telephoners/krakyournet/ctf/repositories/SolutionsRepository.java
View file @
cb3c2b61
package
com
.
telephoners
.
krakyournet
.
ctf
.
repositories
;
package
com
.
telephoners
.
krakyournet
.
ctf
.
repositories
;
import
com.telephoners.krakyournet.ctf.beans.Flag
;
import
com.telephoners.krakyournet.ctf.beans.Solution
;
import
com.telephoners.krakyournet.ctf.beans.Solution
;
import
com.telephoners.krakyournet.ctf.beans.Team
;
import
com.telephoners.krakyournet.ctf.beans.Team
;
import
com.telephoners.krakyournet.ctf.beans.tasks.Task
;
import
com.telephoners.krakyournet.ctf.beans.tasks.Task
;
...
@@ -26,7 +27,7 @@ public class SolutionsRepository extends Repository<Solution>
...
@@ -26,7 +27,7 @@ public class SolutionsRepository extends Repository<Solution>
this
.
tasksRepository
=
tasksRepository
;
this
.
tasksRepository
=
tasksRepository
;
}
}
public
Map
<
Integer
,
List
<
Strin
g
>>
getTeamSolutions
(
Team
team
)
public
Map
<
Integer
,
List
<
Fla
g
>>
getTeamSolutions
(
Team
team
)
{
{
//todo: do not identify team by name? conflict in team ids?
//todo: do not identify team by name? conflict in team ids?
return
datastore
.
createQuery
(
Solution
.
class
)
return
datastore
.
createQuery
(
Solution
.
class
)
...
@@ -45,7 +46,7 @@ public class SolutionsRepository extends Repository<Solution>
...
@@ -45,7 +46,7 @@ public class SolutionsRepository extends Repository<Solution>
.
collect
(
Collectors
.
toMap
(
.
collect
(
Collectors
.
toMap
(
taskSolutions
->
taskSolutions
.
getKey
().
getLevel
(),
taskSolutions
->
taskSolutions
.
getKey
().
getLevel
(),
taskSolutions
->
taskSolutions
.
getValue
().
stream
()
taskSolutions
->
taskSolutions
.
getValue
().
stream
()
.
map
(
solution
->
solution
.
getFlag
().
getDescription
()
).
collect
(
Collectors
.
toList
())
.
map
(
Solution:
:
getFlag
).
collect
(
Collectors
.
toList
())
));
));
}
}
...
@@ -59,10 +60,10 @@ public class SolutionsRepository extends Repository<Solution>
...
@@ -59,10 +60,10 @@ public class SolutionsRepository extends Repository<Solution>
public
List
<
Integer
>
getCompletedTasks
(
Team
team
)
public
List
<
Integer
>
getCompletedTasks
(
Team
team
)
{
{
Map
<
Integer
,
List
<
Strin
g
>>
teamSolutions
=
getTeamSolutions
(
team
);
Map
<
Integer
,
List
<
Fla
g
>>
teamSolutions
=
getTeamSolutions
(
team
);
return
tasksRepository
.
getAll
().
stream
()
return
tasksRepository
.
getAll
().
stream
()
.
filter
(
task
->
{
.
filter
(
task
->
{
List
<
Strin
g
>
teamTaskSolutions
=
teamSolutions
.
get
(
task
.
getLevel
());
List
<
Fla
g
>
teamTaskSolutions
=
teamSolutions
.
get
(
task
.
getLevel
());
return
teamTaskSolutions
!=
null
&&
teamTaskSolutions
.
size
()
==
task
.
getFlags
().
size
();
return
teamTaskSolutions
!=
null
&&
teamTaskSolutions
.
size
()
==
task
.
getFlags
().
size
();
})
})
.
map
(
Task:
:
getLevel
)
.
map
(
Task:
:
getLevel
)
...
...
service/src/main/java/com/telephoners/krakyournet/ctf/resources/SolutionsResource.java
View file @
cb3c2b61
...
@@ -76,7 +76,7 @@ public class SolutionsResource
...
@@ -76,7 +76,7 @@ public class SolutionsResource
@GET
@GET
@Path
(
"/all"
)
@Path
(
"/all"
)
public
Map
<
String
,
Map
<
Integer
,
List
<
Strin
g
>>>
getTeamsSolutions
()
public
Map
<
String
,
Map
<
Integer
,
List
<
Fla
g
>>>
getTeamsSolutions
()
{
{
return
teamsRepository
.
getAll
()
return
teamsRepository
.
getAll
()
.
stream
()
.
stream
()
...
...
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