Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
student-tournament-hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Schneider Stefan
student-tournament-hub
Commits
9baecce2
Commit
9baecce2
authored
1 year ago
by
Jonas
Browse files
Options
Downloads
Patches
Plain Diff
26.12.2023 - refactored classes Team and Match
parent
9a0b8b28
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Dev in Main Merge
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sth-backend/src/main/java/hdm/mi/sthbackend/model/Match.java
+5
-27
5 additions, 27 deletions
sth-backend/src/main/java/hdm/mi/sthbackend/model/Match.java
sth-backend/src/main/java/hdm/mi/sthbackend/model/Team.java
+2
-1
2 additions, 1 deletion
sth-backend/src/main/java/hdm/mi/sthbackend/model/Team.java
with
7 additions
and
28 deletions
sth-backend/src/main/java/hdm/mi/sthbackend/model/Match.java
+
5
−
27
View file @
9baecce2
package
hdm.mi.sthbackend.model
;
import
hdm.mi.sthbackend.exeptions.TeamMatchScoreIdNotFoundException
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.Setter
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Map
;
import
java.util.UUID
;
@Getter
...
...
@@ -22,34 +19,15 @@ public class Match {
@Id
private
UUID
matchId
;
private
List
<
TeamMatchScore
>
teamScores
;
// todo problem mit doppelten gespeicherten daten? Eher nur UUID nutzen für winner
private
Map
<
UUID
,
Number
>
teamScores
;
@Setter
private
Team
winner
;
private
UUID
winner
TeamId
;
@Setter
private
String
comment
;
@Setter
private
Match
nextMatch
;
public
void
removeTeam
(
UUID
teamMatchScoreId
)
throws
Exception
{
TeamMatchScore
team
=
teamScores
.
stream
().
filter
(
t
->
t
.
getTeamMatchScoreId
().
equals
(
teamMatchScoreId
)).
findFirst
().
orElse
(
null
);
log
.
debug
(
"removeTeam: "
+
team
);
if
(
team
==
null
)
{
throw
new
TeamMatchScoreIdNotFoundException
(
String
.
format
(
"TeamMatchScoreID %s was not found"
,
teamMatchScoreId
));
}
teamScores
.
remove
(
team
);
}
public
void
removeTeam
(
TeamMatchScore
team
)
{
teamScores
.
remove
(
team
);
}
public
TeamMatchScore
[]
getAllTeams
()
{
return
(
TeamMatchScore
[])
teamScores
.
stream
().
filter
(
Objects:
:
nonNull
).
toArray
();
}
private
UUID
nextMatchId
;
}
This diff is collapsed.
Click to expand it.
sth-backend/src/main/java/hdm/mi/sthbackend/model/Team.java
+
2
−
1
View file @
9baecce2
...
...
@@ -6,6 +6,7 @@ import org.springframework.data.annotation.Id;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
@Getter
...
...
@@ -16,5 +17,5 @@ public class Team {
private
final
UUID
id
;
private
final
String
teamName
;
private
final
List
<
Player
>
teamMembers
;
private
final
Map
<
UUID
,
Player
>
teamMembers
;
}
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