Add beautiful output

This commit is contained in:
2020-10-25 14:33:49 +01:00
parent 6579d3c003
commit d8e70fb1b0
10 changed files with 93 additions and 39 deletions
@@ -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;
}
}