Skip to content

Commit

Permalink
Merge ho7.1 (#1872)
Browse files Browse the repository at this point in the history
* Release/7 (#1859)

* start HO7.1

* #1856 fix currency of secondary teams

* #1856 fix currency of secondary teams

---------

Co-authored-by: wsbrenk <zissener-weg-brenk.de>

* #1857 fix playername getter in MatchHighlightsTable (#1860)

Co-authored-by: wsbrenk <zissener-weg-brenk.de>

* #1861 fix exception in GoalDiffCriteria (#1864)

Co-authored-by: wsbrenk <zissener-weg-brenk.de>

* Fix click on “Last Match” column when it has been moved. (#1863)

The “Last Match” column is clickable, and opens:
- The match in Hattrick when shift-clicking,
- The match in HO when double-clicking.

This commit also adds some comment to clarify the behaviour.

* Minor UI improvement in teamAnalyzer. (#1867)

This adds a bit of padding around the check boxes on the teamAnalyser panel,
and centers the automatic / manual radio buttons.

It also cleans up code a bit, in particular in lineup assistant.  Probably more
effort to come on that front.

* #1858 (#1869)

* #1858 debug date time parsing

* #1858 debug currency parsing

* #1858 using Helper.formatCurrency

* #1858 Player.baseWage reset setter getter (not used for now, but senseful for the future)

* #1858 Player.baseWage reset setter getter (not used for now, but senseful for the future)

* #1858 translate comments in Helper.java

* #1858 remove  unused imports in HODateTime.java (add some comments)

* #1858 fix Player.setExpiryDate, use localized DateTimeFormatter

* #1858 fix PlayerConverter add comment explaining offsSpecialty

* #1858 fix PlayerConverter remove old commented methods

* #1858 fix PlayerConverter.parseLocalDateTime

* #1858 PlayerConverter scan wage

* #1858 PlayerConverter scan skill refactored

* #1858 PlayerConverter scan wage
fix indexRowWarning

* Fixes deadline date parsing in Transfer Scout.

---------

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

---------

Co-authored-by: Sébastien Le Callonnec <[email protected]>
  • Loading branch information
wsbrenk and tychobrailleur authored May 8, 2023
1 parent 8bc4761 commit 51edf67
Show file tree
Hide file tree
Showing 20 changed files with 959 additions and 972 deletions.
15 changes: 6 additions & 9 deletions src/main/java/core/datatype/CBItem.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package core.datatype;

/**
* Combo item that associates an ID to a String.
*
* @author thomas.werth
* @version
*/
public class CBItem implements ComboItem {

private String m_sText;
private int m_iId;
private final String m_sText;
private final int m_iId;

public CBItem(String text, int id) {
m_sText = text;
Expand All @@ -26,12 +27,8 @@ public final String getText() {

@Override
public final boolean equals(Object obj) {
if (obj instanceof CBItem) {
final CBItem temp = (CBItem) obj;

if (this.getId() == temp.getId()) {
return true;
}
if (obj instanceof CBItem temp) {
return this.getId() == temp.getId();
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/db/MatchHighlightsTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected void initColumns() {
ColumnDescriptor.Builder.newInstance().setColumnName("MatchDate").setGetter((o) -> HODateTime.toDbTimestamp(((MatchEvent) o).getMatchDate())).setSetter((o, v) -> ((MatchEvent) o).setMatchDate((HODateTime) v)).setType(Types.TIMESTAMP).isNullable(true).build(),
ColumnDescriptor.Builder.newInstance().setColumnName("Minute").setGetter((o) -> ((MatchEvent) o).getMinute()).setSetter((o, v) -> ((MatchEvent) o).setMinute((int) v)).setType(Types.INTEGER).isNullable(false).build(),
ColumnDescriptor.Builder.newInstance().setColumnName("SpielerId").setGetter((o) -> ((MatchEvent) o).getPlayerId()).setSetter((o, v) -> ((MatchEvent) o).setPlayerId((int) v)).setType(Types.INTEGER).isNullable(false).build(),
ColumnDescriptor.Builder.newInstance().setColumnName("SpielerName").setGetter((o) -> ((MatchEvent) o).getPlayerId()).setSetter((o, v) -> ((MatchEvent) o).setPlayerName((String) v)).setType(Types.VARCHAR).setLength(256).isNullable(false).build(),
ColumnDescriptor.Builder.newInstance().setColumnName("SpielerName").setGetter((o) -> ((MatchEvent) o).getPlayerName()).setSetter((o, v) -> ((MatchEvent) o).setPlayerName((String) v)).setType(Types.VARCHAR).setLength(256).isNullable(false).build(),
ColumnDescriptor.Builder.newInstance().setColumnName("SpielerHeim").setGetter((o) -> ((MatchEvent) o).getSpielerHeim()).setSetter((o, v) -> ((MatchEvent) o).setSpielerHeim((boolean) v)).setType(Types.BOOLEAN).isNullable(false).build(),
ColumnDescriptor.Builder.newInstance().setColumnName("GehilfeID").setGetter((o) -> ((MatchEvent) o).getAssistingPlayerId()).setSetter((o, v) -> ((MatchEvent) o).setAssistingPlayerId((int) v)).setType(Types.INTEGER).isNullable(false).build(),
ColumnDescriptor.Builder.newInstance().setColumnName("GehilfeName").setGetter((o) -> ((MatchEvent) o).getAssistingPlayerName()).setSetter((o, v) -> ((MatchEvent) o).setAssistingPlayerName((String) v)).setType(Types.VARCHAR).setLength(256).isNullable(false).build(),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/db/ScoutTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ protected void initColumns() {
*/
void saveScoutList(Vector<ScoutEintrag> list) {
executePreparedDelete();
// What should be done when list = null?? jailbird.
if (list != null) {
for (var scout : list) {
scout.setIsStored(false);
store(scout);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/core/file/xml/ConvertXml2Hrf.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ private ConvertXml2Hrf() {
if ( lastPremierId != null && lastPremierId == usersPremierTeamId ){
//if (ModuleConfig.instance().containsKey("CurrencyRate")) {
worldDataMap.put("CurrencyRate", ModuleConfig.instance().getString("CurrencyRate"));
worldDataMap.put("CountryId", ModuleConfig.instance().getString("CountryId"));
worldDataMap.put("CountryID", ModuleConfig.instance().getString("CountryId"));
} else {
// We need to get hold of the currency info for the primary team, no matter which team we download.
usersPremierTeamInfo = XMLWorldDetailsParser.updateTeamInfoWithCurrency(usersPremierTeamInfo, mc.getWorldDetails(usersPremierTeamInfo.getLeagueId()));
ModuleConfig.instance().setString("CurrencyRate", usersPremierTeamInfo.getCurrencyRate().trim());
ModuleConfig.instance().setString("CountryId", usersPremierTeamInfo.getCountryId());
ModuleConfig.instance().setInteger("UsersPremierTeamId", usersPremierTeamInfo.getTeamId());
worldDataMap.put("CurrencyRate", ModuleConfig.instance().getString("CurrencyRate"));
worldDataMap.put("CountryId", ModuleConfig.instance().getString("CountryId"));
worldDataMap.put("CountryID", ModuleConfig.instance().getString("CountryId"));
}

HOMainFrame.instance().setInformation(Helper.getTranslation("ls.update_status.players_information"), progressIncrement);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/core/model/XtraData.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public class XtraData extends AbstractTable.Storable {
private HODateTime m_TrainingDate;
private boolean m_bHasPromoted;
private double m_dCurrencyRate = -1.0d;

/**
* Id of the user's premier team
* (same currency with all teams of the user)
*/
private Integer m_iCountryId;

/**
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/core/util/HODateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public static HODateTime fromDbTimestamp(Timestamp timestamp) {
return null;
}

/**
* Convert to database timestamp
* @param time HODatetime
* @return Timestamp
*/
public static Timestamp toDbTimestamp(HODateTime time) {
if (time != null) {
return time.toDbTimestamp();
Expand All @@ -103,6 +108,11 @@ public static HODateTime fromHTWeek(HTWeek week) {
return new HODateTime(HT_START.instant.plus(Duration.ofDays(((week.season - 1) * 16L + week.week - 1) * 7)));
}

/**
* Convert to seconds since epoch (1-1-1070)
* @param ts HODateTime
* @return long, seconds since epoch
*/
static public long toEpochSecond(HODateTime ts){
if ( ts!= null) return ts.instant.getEpochSecond();
return 0L;
Expand All @@ -126,6 +136,11 @@ public String toLocaleDate() {
return toLocaleDate(FormatStyle.MEDIUM);
}

/**
* Convert date only string
* @param style, FormatStyle
* @return String
*/
public String toLocaleDate(FormatStyle style) {
var formatter = DateTimeFormatter.ofLocalizedDate(style).withZone(ZoneId.systemDefault());
return formatter.format(instant);
Expand All @@ -139,16 +154,33 @@ public String toLocaleDate(FormatStyle style) {
public String toLocaleDateTime() {
return toLocaleDateTime(FormatStyle.MEDIUM);
}

/**
* Convert HODateTime to date and time string
* @param in HODateTime
* @return String
*/
public static String toLocaleDateTime(HODateTime in){
if ( in != null) return in.toLocaleDateTime(FormatStyle.MEDIUM);
return "";
}

/**
* Convert to date and time string
* @param style, FormatStyle
* @return String
*/
public String toLocaleDateTime(FormatStyle style) {
var formatter = DateTimeFormatter.ofLocalizedDateTime(style).withZone(ZoneId.systemDefault());
return formatter.format(instant);
}

/**
* Convert HODateTime to date and time string
* @param in, HODateTime
* @param style, FormatStyle
* @return String
*/
public static String toLocaleDateTime(HODateTime in, FormatStyle style){
if ( in != null) return in.toLocaleDateTime(style);
return "";
Expand Down
Loading

0 comments on commit 51edf67

Please sign in to comment.