Skip to content

Commit

Permalink
Mergev8 (#2100)
Browse files Browse the repository at this point in the history
* #1797 create beta (#2052)

* Fix build (#2054)

* #1797 create beta

* #1797 fix build

* #2055 fix slow opening of team analyzer panel (#2056)

* update release_notes.md

* #2055 remove unused info label

* #2055 remove unused info label (code analysis results)

* #2055 release_notes.md

* #2055 release_notes.md

* Use SwingWorker to properly fix hanging UI. (#2057)

* Update dependencies, in particular OkHttp to fix CVE. (#2058)

This fixes CVE-2023-3635, cf. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-3635

* #2059 fix currency error in team analyzer's total salary column (#2060)

* #2063 add 5 new countries to international flags module (#2064)

* #2063 add 5 new countries to international flags module

* #2063 add 5 new countries to international flags module (review)

* release_notes.md translator

* #2063 the flag files

* #2065 truncate match report if string is too long for database column (#2066)

* #2065 truncate match report if string is too long for database column

* #2065 rename AbstractTable.truncateString

* #2063 Guinea (#2068)

* #2063 download missing world details (#2070)

* #2063 download missing world details

* #2063 download missing world details

* #2063 download missing world details

* #2063 fix database error on matches reload

* #2069 (#2072)

* #2069 reduce space between team summary labels

* #2069 release_notes.md

* #1455 Initialize series table if no matches are played yet (#2073)

* #2069 reduce space between team summary labels

* #2069 release_notes.md

* #1455 initialize series table if no matches are played yet

* #1455 fix initial order of series table

* #1455 review

* #1455 review

* #1455 review

* #1455 review

* #1455 review

* #2074 update ratings when team spirit is changed (#2075)

* #1455 review

* #2074 update ratings when team spirit is changed

* #2076 sorting of youth table average column (#2077)

* #2078 ts forecast loads all trainer data (#2079)

* #2078 ts forecast loads all trainer data

* #2078 release_notes.md

* Create `stable` tag when `tag_stable` is created. (#2083) (#2085)

* Release/8 (#2084)

* Create `stable` tag when `tag_stable` is created.

* release stable HO8

* release stable HO8

---------

Co-authored-by: Sébastien Le Callonnec <[email protected]>

* Select suffix in extension block, as it then becomes immutable. (#2093)

* Fix issue with incorrect `-DEV` suffix in release.

The elvis operator returns the alternate branch if the condition is an empty string:

```groovy
groovy:000> "" ?: "pouet"
===> pouet

```

* Revert stable tag change to see if this is the root cause.

* Update version if GH action.

* Restore code.

* Re-create buid after manual delete of tags.

* Update release-dev.yml

Try using patched version to delete released version.

* Update release-dev.yml

Using the full SHA, as apparently this is required...

...although GH is even able to tell me which exact SHA to use!!  Also set the new option to true to trigger the deletion of non-draft.

* Update release-dev.yml

Latest version of GH action.

* Update release-dev.yml

* Update release-dev.yml

* #2094 youth scout comment sql error (#2095)

* #2094 youth scout comment sql error

* #2094 start 8.1 beta

* #2094 start 8.1 beta

* #2092 Fix skill tester rating predictions (#2098)

* #2092 Fix skill tester rating predictions

* #2092 typo

* #2097 Fix exception in youth player substitution (#2099)

* #2094 youth scout comment sql error

* #2094 start 8.1 beta

* #2094 start 8.1 beta

* #2092 typo

* #2097 Fix MatchLineupTeam.examineSubstitution

* #2097 build.gradle git reporting of v8.1

* #2097 Fix npe in MatchLineupTeam.initMinutesOfPlayersInSectors (#2101)

---------

Co-authored-by: Sébastien Le Callonnec <[email protected]>
  • Loading branch information
wsbrenk and tychobrailleur authored Jul 6, 2024
1 parent 90ee987 commit 51049cd
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 182 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ jobs:
id: show_version
run: cat version.properties
- name: Delete previous tag and release
uses: ClementTsang/delete-tag-and-release@v0.4.0
uses: tychobrailleur/delete-tag-and-release@453626e2f16a2625a19e18d91e4cdf1f41624dde
with:
delete_release: true
delete_non_draft: true
tag_name: ${{ steps.read_version_properties.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
Expand Down Expand Up @@ -73,9 +74,10 @@ jobs:
--data '{ "draft": false }'
- name: If not dev-release delete previous short version tag
if: ${{ steps.read_version_properties.outputs.tag != 'dev' }}
uses: ClementTsang/delete-tag-and-release@v0.3.1
uses: tychobrailleur/delete-tag-and-release@453626e2f16a2625a19e18d91e4cdf1f41624dde
with:
delete_release: true
delete_non_draft: true
tag_name: ${{ steps.read_version_properties.outputs.shortVersion }}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
Expand Down
10 changes: 4 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ version = '9.0'
ext {
// Development_stage (DEV:0 BETA:1 STABLE:2)
development_stage = project.properties['DEV_STAGE'] as Integer ?: 0
version_type = "-DEV"
version_type = ["-DEV", "-BETA", ""].get(development_stage)
target_dir = "${buildDir}/artefacts"
}

Expand Down Expand Up @@ -238,8 +238,6 @@ tasks.register("createVersion") {
versionProps['tag'] = ['dev', 'beta', 'tag_stable'].get(developmentStage)
versionProps['branch'] = currentBranch

project.ext.version_type = ["-DEV", "-BETA", ""].get(developmentStage)

// Write to version.properties file
def versionPropsFile = new File('version.properties')
versionProps.store(versionPropsFile.newWriter(), null)
Expand Down Expand Up @@ -347,9 +345,9 @@ tasks.register("pushmd") {
// list the contributors that don't want to be mentioned in release notes
def contributorFilter = ["Che"]

def commitCount = callGit('git rev-list 7.0..HEAD --count')
def diff = callGit('git diff --shortstat 7.0..HEAD')
def contributors = filter(callGit('git shortlog -s -n 7.0..HEAD'), contributorFilter)
def commitCount = callGit('git rev-list 8.0..HEAD --count')
def diff = callGit('git diff --shortstat 8.0..HEAD')
def contributors = filter(callGit('git shortlog -s -n 8.0..HEAD'), contributorFilter)
def latestCommit = callGit('git log -1 --pretty=format:"%s"')

println("create release-notes")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/model/match/MatchEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void setMatchDate(HODateTime matchDate) {
public enum MatchEventID {
UNKNOWN_MATCHEVENT(-1),
PLAYERS_ENTER_THE_FIELD(19), TACTICAL_DISPOSITION(20), PLAYER_NAMES_IN_LINEUP(21), PLAYERS_FROM_NEIGHBORHOOD_USED(22), SAME_FORMATION_BOTH_TEAMS(23), TEAM_FORMATIONS_DIFFERENT(24),
REGIONAL_DERBY(25), NEUTRAL_GROUND(26), AWAY_IS_ACTUALLY_HOME(27), SPECTATORS_OR_VENUE_RAIN(30), SPECTATORS_OR_VENUE_CLOUDY(31), SPECTATORS_OR_VENUE_FAIR_WEATHER(32),
REGIONAL_DERBY(25), NEUTRAL_GROUND(26), AWAY_IS_ACTUALLY_HOME(27), WALKOVER_LINEUP_USED(28), SPECTATORS_OR_VENUE_RAIN(30), SPECTATORS_OR_VENUE_CLOUDY(31), SPECTATORS_OR_VENUE_FAIR_WEATHER(32),
SPECTATORS_OR_VENUE_SUNNY(33), ARENA_EXTENDED_WITH_TEMPORARY_SEATS(35), ONLY_VENUE_RAIN(36), ONLY_VENUE_CLOUDY(37), ONLY_VENUE_FAIR_WEATHER(38), ONLY_VENUE_SUNNY(39),
DOMINATED(40), BEST_PLAYER(41), WORST_PLAYER(42), HALF_TIME_RESULTS(45), HATTRICK_COMMENT(46), NO_TEAM_DOMINATED(47), PENALTY_CONTEST_GOAL_BY_TECHNICAL_NO_NERVES(55),
PENALTY_CONTEST_GOAL_NO_NERVES(56), PENALTY_CONTEST_GOAL_IN_SPITE_OF_NERVES(57), PENALTY_CONTEST_NO_GOAL_BECAUSE_OF_NERVES(58), PENALTY_CONTEST_NO_GOAL_IN_SPITE_OF_NO_NERVES(59),
Expand Down
134 changes: 29 additions & 105 deletions src/main/java/core/model/match/MatchLineupTeam.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,86 +286,6 @@ public final void add2Lineup(MatchLineupPosition player) {
lineup.setPosition(player);
}

/**
* Determines the played formation.
*/
public final byte determineSystem() {
short abw = 0;
short mf = 0;
short st = 0;

for (var matchRoleId : getLineup().getFieldPositions()) {
if (matchRoleId != null) {
switch (matchRoleId.getSector()) {
default -> {
}
case CentralDefence, Back -> abw++;
case InnerMidfield, Wing -> mf++;
case Forward -> st++;
}
}
}

if (abw == 2) {
// 253
if (mf == 5) {
return Lineup.SYS_253;
}
// MURKS
else {
return Lineup.SYS_MURKS;
}
} else if (abw == 3) {
// 343
if (mf == 4) {
return Lineup.SYS_343;
} // 352
else if ((mf == 5) && (st == 2)) {
return Lineup.SYS_352;
}
// MURKS
else {
return Lineup.SYS_MURKS;
}
} else if (abw == 4) {
// 433
if ((mf == 3) && (st == 3)) {
return Lineup.SYS_433;
} // 442
else if ((mf == 4) && (st == 2)) {
return Lineup.SYS_442;
} // 451
else if ((mf == 5) && (st == 1)) {
return Lineup.SYS_451;
}
// MURKS
else {
return Lineup.SYS_MURKS;
}
} else if (abw == 5) {
// 532
if ((mf == 3) && (st == 2)) {
return Lineup.SYS_532;
} // 541
else if ((mf == 4) && (st == 1)) {
return Lineup.SYS_541;
} // 523
else if ((mf == 2) && (st == 3)) {
return Lineup.SYS_523;
} // 550
else if ((mf == 5) && (st == 0)) {
return Lineup.SYS_550;
}
// MURKS
else {
return Lineup.SYS_MURKS;
}
} // MURKS
else {
return Lineup.SYS_MURKS;
}
}

public MatchType getMatchType() {
if (matchType == MatchType.NONE) {
MatchKurzInfo info = DBManager.instance().getMatchesKurzInfoByMatchID(this.matchId, matchType);
Expand Down Expand Up @@ -690,29 +610,30 @@ private void initMinutesOfPlayersInSectors() {
// examine last minutes
for (var app : lastMatchAppearances.entrySet()) {
var player = app.getValue().player;
//player.addMinutesInSector(getMatchEndMinute(player.getPlayerId())-app.getValue().minute, app.getKey());
addPlayersMinutesInSector(player.getPlayerId(),
app.getValue().getSector(),
getMatchEndMinute(player.getPlayerId()) - app.getValue().minute);
if (player != null) {
addPlayersMinutesInSector(player.getPlayerId(),
app.getValue().getSector(),
getMatchEndMinute(player.getPlayerId()) - app.getValue().minute);
}
}
}

private void examineSubstitution(Substitution substitution) {
var leavingplayer = this.getPlayerByID(substitution.getSubjectPlayerID(),true);
if ( leavingplayer == null){
leavingplayer = new MatchLineupPosition(substitution.getRoleId(), substitution.getSubjectPlayerID(), substitution.getBehaviour());
var leavingPlayer = this.getPlayerByID(substitution.getSubjectPlayerID(),true);
if ( leavingPlayer == null){
leavingPlayer = new MatchLineupPosition(substitution.getRoleId(), substitution.getSubjectPlayerID(), substitution.getBehaviour());
}
switch (substitution.getOrderType()) {
case NEW_BEHAVIOUR -> {
removeMatchAppearance(leavingplayer, substitution.getMatchMinuteCriteria());
removeMatchAppearance(leavingPlayer, substitution.getMatchMinuteCriteria());
if ( substitution.getRoleId() > 0) {
lastMatchAppearances.put((int) substitution.getRoleId(), new MatchAppearance(leavingplayer, substitution.getMatchMinuteCriteria()));
lastMatchAppearances.put((int) substitution.getRoleId(), new MatchAppearance(leavingPlayer, substitution.getMatchMinuteCriteria()));
}
}
case SUBSTITUTION -> {
var setPiecesTaker = lastMatchAppearances.get(MatchRoleID.setPieces);
var leavingPlayerIsSetPiecesTaker = setPiecesTaker != null && setPiecesTaker.player == leavingplayer;
removeMatchAppearance(leavingplayer, substitution.getMatchMinuteCriteria());
var leavingPlayerIsSetPiecesTaker = setPiecesTaker != null && setPiecesTaker.player == leavingPlayer;
removeMatchAppearance(leavingPlayer, substitution.getMatchMinuteCriteria());
var enteringplayer = this.getPlayerByID(substitution.getObjectPlayerID(), true);
if ( enteringplayer == null){
enteringplayer = new MatchLineupPosition(substitution.getRoleId(), substitution.getObjectPlayerID(), substitution.getBehaviour());
Expand All @@ -731,27 +652,30 @@ private void examineSubstitution(Substitution substitution) {
}
case POSITION_SWAP -> {
var player = this.getPlayerByID(substitution.getObjectPlayerID(), true);
var leavingRole = removeMatchAppearance(leavingplayer, substitution.getMatchMinuteCriteria());
var playerRole = removeMatchAppearance(player, substitution.getMatchMinuteCriteria());
lastMatchAppearances.put(playerRole, new MatchAppearance(leavingplayer, substitution.getMatchMinuteCriteria()));
if ( player != null ){
var playerRole = removeMatchAppearance(player, substitution.getMatchMinuteCriteria());
lastMatchAppearances.put(playerRole, new MatchAppearance(leavingPlayer, substitution.getMatchMinuteCriteria()));
}
var leavingRole = removeMatchAppearance(leavingPlayer, substitution.getMatchMinuteCriteria());
lastMatchAppearances.put(leavingRole, new MatchAppearance(player, substitution.getMatchMinuteCriteria()));
}
}
}

private int removeMatchAppearance(MatchLineupPosition leavingplayer, int minute) {
private int removeMatchAppearance(MatchLineupPosition leavingPlayer, int minute) {
int ret = MatchRoleID.UNKNOWN;
var entries = lastMatchAppearances.entrySet().stream()
.filter(i -> i.getValue().getPlayerId() == leavingplayer.getPlayerId()).toList();
for (var entry : entries) {
var appearance = entry.getValue();
var role = entry.getKey();
if (role != MatchRoleID.setPieces) { // do not return set pieces taker role of leaving player
ret = role;
if (leavingPlayer != null) {
var entries = lastMatchAppearances.entrySet().stream()
.filter(i -> i.getValue().getPlayerId() == leavingPlayer.getPlayerId()).toList();
for (var entry : entries) {
var appearance = entry.getValue();
var role = entry.getKey();
if (role != MatchRoleID.setPieces) { // do not return set pieces taker role of leaving player
ret = role;
}
addPlayersMinutesInSector(leavingPlayer.getPlayerId(), MatchRoleID.getSector(role), minute - appearance.minute);
lastMatchAppearances.remove(entry.getKey());
}
//leavingplayer.addMinutesInSector(minute-appearance.minute, role);
addPlayersMinutesInSector(leavingplayer.getPlayerId(), MatchRoleID.getSector(role), minute - appearance.minute);
lastMatchAppearances.remove(entry.getKey());
}
return ret;
}
Expand Down
Loading

0 comments on commit 51049cd

Please sign in to comment.