Skip to content

Commit

Permalink
#1905 load skill changes from player table (#1974)
Browse files Browse the repository at this point in the history
* #1905 load skill changes from player table

* #1905 beautify
  • Loading branch information
wsbrenk authored Dec 5, 2023
1 parent 1fb794f commit 0d04f57
Show file tree
Hide file tree
Showing 20 changed files with 248 additions and 528 deletions.
41 changes: 5 additions & 36 deletions src/main/java/core/db/DBManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import core.HO;
import core.constants.TeamConfidence;
import core.constants.TeamSpirit;
import core.constants.player.PlayerSkill;
import core.db.backup.BackupDialog;
import core.db.user.User;
import core.db.user.UserManager;
Expand All @@ -20,7 +19,6 @@
import core.model.misc.Economy;
import core.model.misc.Verein;
import core.model.player.Player;
import core.model.player.Skillup;
import core.training.FuturePlayerSkillTraining;
import core.util.HODateTime;
import module.matches.MatchLocation;
Expand Down Expand Up @@ -266,7 +264,6 @@ private void initAllTables() {
tables.put(FutureTrainingTable.TABLENAME, new FutureTrainingTable(connectionManager));
tables.put(FuturePlayerSkillTrainingTable.TABLENAME, new FuturePlayerSkillTrainingTable(connectionManager));
tables.put(UserConfigurationTable.TABLENAME,new UserConfigurationTable(connectionManager));
tables.put(SkillupTable.TABLENAME, new SkillupTable(connectionManager));
tables.put(StaffTable.TABLENAME, new StaffTable(connectionManager));
tables.put(MatchSubstitutionTable.TABLENAME, new MatchSubstitutionTable(connectionManager));
tables.put(TransferTable.TABLENAME, new TransferTable(connectionManager));
Expand All @@ -276,7 +273,6 @@ private void initAllTables() {
tables.put(TAPlayerTable.TABLENAME, new TAPlayerTable(connectionManager));
tables.put(WorldDetailsTable.TABLENAME, new WorldDetailsTable(connectionManager));
tables.put(IfaMatchTable.TABLENAME, new IfaMatchTable(connectionManager));
// tables.put(PenaltyTakersTable.TABLENAME, new PenaltyTakersTable(connectionManager));
tables.put(TournamentDetailsTable.TABLENAME, new TournamentDetailsTable(connectionManager));
tables.put(FuturePlayerTrainingTable.TABLENAME, new FuturePlayerTrainingTable((connectionManager)));
tables.put(MatchTeamRatingTable.TABLENAME, new MatchTeamRatingTable(connectionManager));
Expand Down Expand Up @@ -357,37 +353,6 @@ private boolean checkIfDBExists() {
return exists;
}

/**
* liefert das Datum des letzen LevelAufstiegs für den angeforderten Skill
* Vector filled with Skillup Objects
*
* @param skill the skill
* @param m_iSpielerID the m i spieler id
* @return the all level up
*/
public List<Skillup> getAllLevelUp(PlayerSkill skill, int m_iSpielerID) {
return ((SkillupTable) getTable(SkillupTable.TABLENAME))
.getAllLevelUp(skill, m_iSpielerID);
}

/**
* Check skillup.
*
* @param homodel the homodel
*/
public void checkSkillup(HOModel homodel) {
((SkillupTable) getTable(SkillupTable.TABLENAME))
.importNewSkillup(homodel);
}

public void storeSkillup(Skillup skillup){
getTable(SkillupTable.TABLENAME)
.store(skillup);
}

// ------------------------------- SpielerTable
// -------------------------------------------------

/**
* Returns all the players, including the former ones.
*
Expand All @@ -399,6 +364,11 @@ public List<Player> loadAllPlayers() {
.loadAllPlayers();
}

public List<Player> loadPlayerHistory(int playerId){
return ((SpielerTable) getTable(SpielerTable.TABLENAME))
.loadPlayerHistory(playerId);
}

/**
* Gibt die letzte Bewertung für den Player zurück // HRF
*
Expand Down Expand Up @@ -1802,7 +1772,6 @@ public void deleteHRF(int hrfid) {
getTable(EconomyTable.TABLENAME).executePreparedDelete(hrfid);
getTable(BasicsTable.TABLENAME).executePreparedDelete(hrfid);
getTable(SpielerTable.TABLENAME).executePreparedDelete(hrfid);
getTable(SkillupTable.TABLENAME).executePreparedDelete(hrfid);
getTable(XtraDataTable.TABLENAME).executePreparedDelete(hrfid);
getTable(StaffTable.TABLENAME).executePreparedDelete(hrfid);
}
Expand Down
86 changes: 0 additions & 86 deletions src/main/java/core/db/SkillupTable.java

This file was deleted.

6 changes: 6 additions & 0 deletions src/main/java/core/db/SpielerTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ List<Player> loadAllPlayers() {
return load(Player.class, connectionManager.executePreparedQuery(loadAllPlayersSql),-1);
}

String loadPlayerHistorySql = createSelectStatement("WHERE SpielerID=? ORDER BY Datum");

List<Player> loadPlayerHistory(int playerId){
return load(Player.class, connectionManager.executePreparedQuery(loadPlayerHistorySql, playerId), -1);
}

private final String getLetzteBewertung4SpielerSql = "SELECT Bewertung from "+getTableName()+" WHERE SpielerID=? AND Bewertung>0 ORDER BY Datum DESC LIMIT 1";

/**
Expand Down
36 changes: 0 additions & 36 deletions src/main/java/core/model/player/ISkillChange.java

This file was deleted.

Loading

0 comments on commit 0d04f57

Please sign in to comment.