Add beautiful output
This commit is contained in:
@@ -125,6 +125,8 @@ public class TLWMatch extends BaseMatch{
|
||||
this.formulaGuest = "";
|
||||
this.status = status;
|
||||
this.koMatch = koMatch;
|
||||
this.teamNameHome = apiFootballMatch.getTeamNameHome();
|
||||
this.teamNameGuest = apiFootballMatch.getTeamNameGuest();
|
||||
}
|
||||
|
||||
public TLWMatch(int season, int league, int matchday, int matchNo, String matchDatetime, int status, int koMatch) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -14,6 +12,7 @@ public class TLWMatchdaysUpdater {
|
||||
int league;
|
||||
ArrayList<TLWMatchday> matchdaysOriginal;
|
||||
ArrayList<TLWMatchday> matchdaysUpdated;
|
||||
String beautifulInfo = "";
|
||||
|
||||
public TLWMatchdaysUpdater(int season, int league, String configPath) throws ParseException {
|
||||
this.season = season;
|
||||
@@ -58,27 +57,40 @@ public class TLWMatchdaysUpdater {
|
||||
String condition = "WHERE season = " + matchdayOriginal.getSeason() + " " +
|
||||
"AND league = " + matchdayOriginal.getLeague() + " " +
|
||||
"AND matchday = " + matchdayOriginal.getMatchday() + ";\n";
|
||||
String beautifulInfoStart = "Aktualisiere Saison " + matchdayOriginal.getSeason() + ", " +
|
||||
"Liga " + matchdayOriginal.getLeague() + ", " +
|
||||
"Spieltag " + matchdayOriginal.getMatchday() + ", ";
|
||||
|
||||
if (!matchdayOriginal.getDeliveryDate().equals(matchdayUpdated.getDeliveryDate())) {
|
||||
updateSql += updateStart +
|
||||
"delivery_date = '" + matchdayUpdated.getDeliveryDate() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Tippabgabeschluss 1 zu '" + matchdayUpdated.getDeliveryDate() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchdayOriginal.getDeliveryDate2().equals(matchdayUpdated.getDeliveryDate2())) {
|
||||
updateSql += updateStart +
|
||||
"delivery_date_2 = '" + matchdayUpdated.getDeliveryDate2() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Tippabgabeschluss 2 zu '" + matchdayUpdated.getDeliveryDate2() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchdayOriginal.getMatchdayName().equals(matchdayUpdated.getMatchdayName())) {
|
||||
updateSql += updateStart +
|
||||
"matchday_name = '" + matchdayUpdated.getMatchdayName() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Spieltagsname zu '" + matchdayUpdated.getMatchdayName() + "'.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return updateSql;
|
||||
}
|
||||
|
||||
public String getBeautifulInfo() {
|
||||
return this.beautifulInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import javax.sound.midi.SysexMessage;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
@@ -21,8 +22,9 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
ArrayList<TLWMatch> tlwMatchesOriginal;
|
||||
ArrayList<TLWMatch> tlwMatchesUpdated;
|
||||
|
||||
public TLWMatchesUpdaterFootball(int season, int league, String configFileName) {
|
||||
String beautifulInfo = "";
|
||||
|
||||
public TLWMatchesUpdaterFootball(int season, int league, String configFileName) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
|
||||
@@ -79,29 +81,42 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
"AND league = " + matchOriginal.getLeague() + " " +
|
||||
"AND matchday = " + matchOriginal.getMatchday() + " " +
|
||||
"AND match_no = " + matchOriginal.getMatchNo() + ";\n";
|
||||
String beautifulInfoStart = "Aktualisiere Saison " + matchOriginal.getSeason() + ", " +
|
||||
"Liga " + matchOriginal.getLeague() + ", " +
|
||||
"Spieltag " + matchOriginal.getMatchday() + ", " +
|
||||
"Spielnummer " + matchOriginal.getMatchNo() + ", " +
|
||||
"Spiel '" + TeamIDMatcher.getTeamNameFromTippligaId(matchOriginal.getTeamIdHome()) + "' - '" + TeamIDMatcher.getTeamNameFromTippligaId(matchOriginal.getTeamIdGuest()) + "', ";
|
||||
|
||||
if(matchOriginal.getTeamIdHome() != matchUpdated.getTeamIdHome()) {
|
||||
updateString += updateStart +
|
||||
"team_id_home = " + matchUpdated.getTeamIdHome() + " " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Heimteam zu '" + matchUpdated.getTeamNameHome() + "'.\n";
|
||||
}
|
||||
|
||||
if(matchOriginal.getTeamIdGuest() != matchUpdated.getTeamIdGuest()) {
|
||||
updateString += updateStart +
|
||||
"team_id_guest = " + matchUpdated.getTeamIdGuest() + " " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Gastteam zu '" + matchUpdated.getTeamNameGuest() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchOriginal.getMatchDateTime().equals(matchUpdated.getMatchDateTime())) {
|
||||
updateString += updateStart +
|
||||
"match_datetime = '" + matchUpdated.getMatchDateTime() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Spielbeginn zu '" + matchUpdated.getMatchDateTime() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchOriginal.getStatus().equals(matchUpdated.getStatus())) {
|
||||
updateString += updateStart +
|
||||
"status = '" + matchUpdated.getStatus() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Status zu '" + matchUpdated.getStatus() + "'.\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +165,7 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
if(earliestDate.isAfter(now)) {
|
||||
for(TLWMatch match : matches) {
|
||||
LocalDateTime date = TLWMatchesManagerBase.getDate(match);
|
||||
if (this.getDaysDifference(earliestDate, date) == 0) {
|
||||
if (getDaysDifference(earliestDate, date) == 0) {
|
||||
match.setStatus(0);
|
||||
} else {
|
||||
match.setStatus(-1);
|
||||
@@ -182,4 +197,8 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
public ArrayList<TLWMatch> getTLWMatchesUpdated() {
|
||||
return this.tlwMatchesUpdated;
|
||||
}
|
||||
|
||||
public String getBeautifulInfo() {
|
||||
return this.beautifulInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,12 +87,12 @@ public class TippligaSQLConnector {
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getMatches(String season, String league) {
|
||||
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE `season` = " + season + " AND `league` = " + league + ";";
|
||||
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE `season` = " + season + " AND `league` = " + league + " ORDER BY match_no ASC;";
|
||||
return getMatches(queryString);
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getMatches(String season, String league, String matchday) {
|
||||
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE `season` = " + season + " AND `league` = " + league + " AND `matchday` = " + matchday + ";";
|
||||
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE `season` = " + season + " AND `league` = " + league + " AND `matchday` = " + matchday + " ORDER BY match_no ASC;";
|
||||
return getMatches(queryString);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user