Skip to content

Commit

Permalink
Readme.md (#1923)
Browse files Browse the repository at this point in the history
* README.md
  • Loading branch information
wsbrenk authored Sep 24, 2023
1 parent 823bfa0 commit 8604597
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 38 deletions.
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<tr>
<td>Latest Release</td>
<td>
<a href="https://github.com/ho-dev/HattrickOrganizer/releases/tag/7.2">
<img src="https://img.shields.io/badge/HO-7.2-brightgreen.svg" alt="latest release" />
<a href="https://github.com/ho-dev/HattrickOrganizer/releases/tag/7.3">
<img src="https://img.shields.io/badge/HO-7.3-brightgreen.svg" alt="latest release" />
</a>
</td>
</tr>
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/core/db/AbstractTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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 <T> Storable class (extends Abstract.Storable)
* @param <T> Storable class (extends AbstractStorable)
*/
public <T extends Storable> void store(T object){
if (object.isStored()) {
Expand All @@ -104,7 +104,7 @@ public <T extends Storable> void store(T object){
/**
* create a new record of the storable object
* @param object that should be created
* @param <T> Storable class (extends Abstract.Starable)
* @param <T> Storable class (extends AbstractStorable)
* @return 1 on success, 0 on error
*/
private <T extends Storable> int insert(T object) {
Expand All @@ -118,7 +118,7 @@ private <T extends Storable> 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 <T> Storable class (extends Abstract.Stobable)
* @param <T> Storable class (extends AbstractStorable)
* @return 1 on success, 0 on error
*/
private <T extends Storable> int update(T object) {
Expand All @@ -134,7 +134,7 @@ private <T extends Storable> 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 <T> the object class to create
* @return one Object of type T
*/
Expand All @@ -144,7 +144,7 @@ public <T extends Storable> T loadOne(Class<T> 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 <T> the object class to create
* @return one object of type T
Expand All @@ -159,8 +159,8 @@ public <T extends Storable> T loadOne(Class<T> 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 <T> the object class to create
* @return List of objects of type T
*/
Expand All @@ -170,7 +170,7 @@ public <T extends Storable> List<T> load(Class<T> 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 <T> the object class to create
* @return List of objects of type T
Expand All @@ -181,7 +181,7 @@ public <T extends Storable> List<T> load(Class<T> 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 <T> the object class to create
Expand Down Expand Up @@ -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() {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/core/db/DBManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ public void checkSkillup(HOModel homodel) {
.importNewSkillup(homodel);
}

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

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

Expand Down
19 changes: 7 additions & 12 deletions src/main/java/core/db/ModuleConfigTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -26,16 +25,12 @@ protected void initColumns() {
* update & insert method
*/
void saveConfig(Map<String, Object> values) {
int updated;
String key;

final Set<String> 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
Expand Down Expand Up @@ -111,7 +106,7 @@ private Object createObject(String value, int type){

@Override
protected void insertDefaultValues(){
if(findAll().size() == 0){
if(findAll().isEmpty()){
HashMap<String, Object> defaults = new HashMap<>();
defaults.put("TA_numericRating", Boolean.FALSE);
defaults.put("TA_descriptionRating", Boolean.TRUE);
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/core/file/xml/ConvertXml2Hrf.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/core/model/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,21 @@ public void calcSubskills(int previousID, List<TrainingPerWeek> 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);
Expand Down
23 changes: 13 additions & 10 deletions src/main/java/module/playerOverview/PlayerDetailsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);

}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/module/training/EffectDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
66 changes: 66 additions & 0 deletions src/main/resources/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8604597

Please sign in to comment.