diff --git a/docs/README.md b/docs/README.md index 34bf6c915..8930809a4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,8 +8,8 @@ Latest Release - - latest release + + latest release diff --git a/src/main/java/core/db/AbstractTable.java b/src/main/java/core/db/AbstractTable.java index 0e5260f13..81fabc968 100644 --- a/src/main/java/core/db/AbstractTable.java +++ b/src/main/java/core/db/AbstractTable.java @@ -50,7 +50,7 @@ protected String getTableType() { } /** - * derived table class has to create the colums array + * derived table class has to create the columns array */ protected abstract void initColumns(); @@ -91,7 +91,7 @@ protected String[] getConstraintStatements() { * stores the given object. * if the object is already stored in database, update is called otherwise insert * @param object that should be stored - * @param Storable class (extends Abstract.Storable) + * @param Storable class (extends AbstractStorable) */ public void store(T object){ if (object.isStored()) { @@ -104,7 +104,7 @@ public void store(T object){ /** * create a new record of the storable object * @param object that should be created - * @param Storable class (extends Abstract.Starable) + * @param Storable class (extends AbstractStorable) * @return 1 on success, 0 on error */ private int insert(T object) { @@ -118,7 +118,7 @@ private int insert(T object) { * The first columns of the table are used in the where clause, the remaining as set values. * Count of id columns is defined by field idcolumns. * @param object that should be updated - * @param Storable class (extends Abstract.Stobable) + * @param Storable class (extends AbstractStorable) * @return 1 on success, 0 on error */ private int update(T object) { @@ -134,7 +134,7 @@ private int update(T object) { * the specified where values must match the first id columns of the table. * The count of where values is defined by idColumns * @param tClass Storable class (extends Abstract.Storable) - * @param whereValues variable arguments descibing the where values (count must match idColumns) + * @param whereValues variable arguments describing the where values (count must match idColumns) * @param the object class to create * @return one Object of type T */ @@ -144,7 +144,7 @@ public T loadOne(Class tClass, Object ... whereValues) { /** * load one object of an externally created result set. - * @param tClass Storable class (extends Abstract.Storable) + * @param tClass Storable class (extends AbstractStorable) * @param rs result set * @param the object class to create * @return one object of type T @@ -159,8 +159,8 @@ public T loadOne(Class tClass, ResultSet rs) { /** * load a list of records - * @param tClass Storable class (extends Abstract.Storable) - * @param whereValues variable arguments descibing the where values (count must match idColumns) + * @param tClass Storable class (extends AbstractStorable) + * @param whereValues variable arguments describing the where values (count must match idColumns) * @param the object class to create * @return List of objects of type T */ @@ -170,7 +170,7 @@ public List load(Class tClass, Object ... whereValues /** * load a list of records of an externally created result set - * @param tClass Storable class (extends Abstract.Storable) + * @param tClass Storable class (extends AbstractStorable) * @param rs result set * @param the object class to create * @return List of objects of type T @@ -181,7 +181,7 @@ public List load(Class tClass, ResultSet rs) { /** * load a list of records - * @param tClass Storable class (extends Abstract.Storable) + * @param tClass Storable class (extends AbstractStorable) * @param rs result set * @param max 1 to load one object, -1 to load all objects * @param the object class to create @@ -374,9 +374,9 @@ protected int executePreparedInsert(Object ... values){ /** - * create sql string of the standard update statment. - * the first colums of table are used in the where clause, the remaining columns in the SET part. - * The count of where values if given by the field idcolumns + * create sql string of the standard update statement. + * the first columns of table are used in the where clause, the remaining columns in the SET part. + * The count of where values if given by the field id columns * @return sql string of the prepared statement */ private String createUpdateStatement() { diff --git a/src/main/java/core/db/DBManager.java b/src/main/java/core/db/DBManager.java index dcf27d21a..deeeb9e08 100644 --- a/src/main/java/core/db/DBManager.java +++ b/src/main/java/core/db/DBManager.java @@ -403,6 +403,11 @@ public void checkSkillup(HOModel homodel) { .importNewSkillup(homodel); } + public void storeSkillup(Skillup skillup){ + getTable(SpielerSkillupTable.TABLENAME) + .store(skillup); + } + // ------------------------------- SpielerTable // ------------------------------------------------- diff --git a/src/main/java/core/db/ModuleConfigTable.java b/src/main/java/core/db/ModuleConfigTable.java index f1154dd5f..f979a16f4 100644 --- a/src/main/java/core/db/ModuleConfigTable.java +++ b/src/main/java/core/db/ModuleConfigTable.java @@ -5,7 +5,6 @@ import java.sql.*; import java.util.HashMap; import java.util.Map; -import java.util.Set; final class ModuleConfigTable extends AbstractTable { final static String TABLENAME = "MODULE_CONFIGURATION"; @@ -26,16 +25,12 @@ protected void initColumns() { * update & insert method */ void saveConfig(Map values) { - int updated; - String key; - - final Set keys = values.keySet(); - for (String s : keys) { - key = s; - updated = updateConfig(key, values.get(key)); - if (updated == 0) - insertConfig(key, values.get(key)); - } // for + for (var entry : values.entrySet()) { + var updated = updateConfig(entry.getKey(), entry.getValue()); + if (updated == 0) { + insertConfig(entry.getKey(), entry.getValue()); + } + } } @Override @@ -111,7 +106,7 @@ private Object createObject(String value, int type){ @Override protected void insertDefaultValues(){ - if(findAll().size() == 0){ + if(findAll().isEmpty()){ HashMap defaults = new HashMap<>(); defaults.put("TA_numericRating", Boolean.FALSE); defaults.put("TA_descriptionRating", Boolean.TRUE); diff --git a/src/main/java/core/file/xml/ConvertXml2Hrf.java b/src/main/java/core/file/xml/ConvertXml2Hrf.java index 313bca45f..919f60fd4 100644 --- a/src/main/java/core/file/xml/ConvertXml2Hrf.java +++ b/src/main/java/core/file/xml/ConvertXml2Hrf.java @@ -142,6 +142,20 @@ private ConvertXml2Hrf() { playersData.add(properties); } + var trainerId = String.valueOf(teamdetailsDataMap.get("TrainerID")); + // If trainer is not in players data, download trainer info from player details + var found = false; + for ( var p : playersData){ + if ( p.get("PlayerID").equals(trainerId)){ + found=true; + break; + } + } + if ( !found){ + var xml = MyConnector.instance().downloadPlayerDetails(trainerId); + playersData.add(new XMLPlayersParser().parsePlayerDetails(xml)); + } + // Download players' avatar HOMainFrame.instance().setInformation(Helper.getTranslation("ls.update_status.players_avatars"), progressIncrement); diff --git a/src/main/java/core/model/player/Player.java b/src/main/java/core/model/player/Player.java index d30112583..4a06c4125 100644 --- a/src/main/java/core/model/player/Player.java +++ b/src/main/java/core/model/player/Player.java @@ -2372,6 +2372,21 @@ public void calcSubskills(int previousID, List trainingWeeks) { var valueAfterTraining = this.getValue4Skill(skill); if (trainingWeeks.size() > 0) { + if ( valueAfterTraining > valueBeforeTraining) { + // Check if skill up is available + var skillUps = this.getAllLevelUp(skill); + var isAvailable = skillUps.stream().anyMatch(i -> i.getValue() == valueAfterTraining); + if (!isAvailable) { + var skillUp = new Skillup(); + skillUp.setPlayerId(this.getPlayerID()); + skillUp.setSkill(skill); + skillUp.setDate(trainingWeeks.get(0).getTrainingDate()); + skillUp.setValue(valueAfterTraining); + skillUp.setHrfId(this.getHrfId()); + DBManager.instance().storeSkillup(skillUp); + resetSkillUpInformation(); + } + } for (var training : trainingWeeks) { var trainingPerPlayer = calculateWeeklyTraining(training); diff --git a/src/main/java/module/playerOverview/PlayerDetailsPanel.java b/src/main/java/module/playerOverview/PlayerDetailsPanel.java index c328109f6..2301d63e6 100644 --- a/src/main/java/module/playerOverview/PlayerDetailsPanel.java +++ b/src/main/java/module/playerOverview/PlayerDetailsPanel.java @@ -275,11 +275,11 @@ private void setLabels() { } - m_jlCareerGoals.setText(m_clPlayer.getAllOfficialGoals() + ""); - m_jlTeamGoals.setText(m_clPlayer.getGoalsCurrentTeam() +""); - m_jlHattricks.setText(m_clPlayer.getHattrick() + ""); - m_jlSeasonSeriesGoals.setText(m_clPlayer.getSeasonSeriesGoal() + ""); - m_jlSeasonCupGoals.setText(m_clPlayer.getSeasonCupGoal() + ""); + m_jlCareerGoals.setText(String.valueOf(m_clPlayer.getAllOfficialGoals())); + m_jlTeamGoals.setText(String.valueOf(m_clPlayer.getGoalsCurrentTeam())); + m_jlHattricks.setText(String.valueOf(m_clPlayer.getHattrick())); + m_jlSeasonSeriesGoals.setText(String.valueOf(m_clPlayer.getSeasonSeriesGoal())); + m_jlSeasonCupGoals.setText(String.valueOf(m_clPlayer.getSeasonCupGoal())); var bestPosition = m_clPlayer.getIdealPosition(); m_jlBestPosition.setText(MatchRoleID.getNameForPosition(bestPosition) @@ -315,7 +315,12 @@ private void setLabels() { else { m_jlInTeamSince.setText(""); } - if (m_clPlayer.isHomeGrown()) m_jlInTeamSince.setIcon(ThemeManager.getIcon(HOIconName.HOMEGROWN)); + if (m_clPlayer.isHomeGrown()){ + m_jlInTeamSince.setIcon(ThemeManager.getIcon(HOIconName.HOMEGROWN)); + } + else { + m_jlInTeamSince.setIcon(null); + } m_jbStatistics.setEnabled(true); m_jbAnalysisTop.setEnabled(true); @@ -1052,7 +1057,7 @@ public void mouseClicked(MouseEvent e) { int matchId = lMatchIDs.get(match_index); if (e.isShiftDown()) { MatchKurzInfo info = DBManager.instance().getMatchesKurzInfoByMatchID(matchId, null); - HattrickLink.showMatch(matchId + "", info.getMatchType().isOfficial()); + HattrickLink.showMatch(String.valueOf(matchId), info.getMatchType().isOfficial()); } else { HOMainFrame.instance().showMatch(matchId); } @@ -1121,9 +1126,7 @@ public void reset(){ _temp.setIcon(null); } - for (int i=0; i < lMatchIDs.size(); i++){ - lMatchIDs.set(i, -1); - } + lMatchIDs.replaceAll(ignored -> -1); } diff --git a/src/main/java/module/training/EffectDAO.java b/src/main/java/module/training/EffectDAO.java index 497565b3b..30e78b226 100644 --- a/src/main/java/module/training/EffectDAO.java +++ b/src/main/java/module/training/EffectDAO.java @@ -89,7 +89,7 @@ public static void reload() { } while (tDateset.next()) { var trainDate = HODateTime.fromDbTimestamp(tDateset.getTimestamp(3)); - var htWeek =trainDate.toHTWeek(); + var htWeek =trainDate.toLocaleHTWeek(); trainingDates.add(new TrainWeekEffect(htWeek.week, htWeek.season, tDateset.getInt(1), first_in_week)); first_in_week = tDateset.getInt(1); } diff --git a/src/main/resources/changelog.md b/src/main/resources/changelog.md index 3f5dfb56a..38a6eae5d 100644 --- a/src/main/resources/changelog.md +++ b/src/main/resources/changelog.md @@ -40,6 +40,72 @@ Reports by Contributors - April 22, 2023 - June 24, 2023 Total 288 +# Changelist HO! 7.2 + +## Some numbers +* 2 commits +* 8 files changed, 90 insertions(+), 31 deletions(-) +* Contributors: + * 2 wsbrenk + +## Highlights +* bug fixes + +## [Detailed Changelog](https://github.com/akasolace/HO/issues?q=milestone%3A7.2) + +### Training +* handle new trainer types which are no longer listed as player (#1889) + +## Translations +Reports by Contributors - June 24, 2023 - July 22, 2023 + +* Moorhuhninho 4 +* Miccoli17 1 +* wsbrenk 1 +Total 6 + +# Changelist HO! 7.1 + +## Some numbers +* 11 commits +* 34 files changed, 1085 insertions(+), 1213 deletions(-) +* Contributors: + * 9 wsbrenk + * 2 Sébastien Le Callonnec + +## Highlights +* bug fixes + +## [Detailed Changelog](https://github.com/ho-dev/HattrickOrganizer/issues?q=milestone%3A7.1) + +### Squad +* fix click on “Last Match” column when the column has been moved. +* fix last match info of nt teams (#1878) + +### Matches +* fix missing player names in match highlights panel (#1857) + +### Lineup +* fix nt team selection options of style of play combo box (#1873) +* fix download error of substitutions with undocumented goal difference criteria (#1881) + +### Statistics +* fix currency of secondary teams (#1856) + +### Transfer +* fix bugs in transfer scout panel (#1858) + +## Translations + +Reports by Contributors - April 22, 2023 - June 24, 2023 + +* Achilles 272 +* sich 4 +* Lidegand 4 +* wsbrenk 4 + +Total 288 + # Changelist HO! 7.0 ## Some numbers