Add support for third delivery date
This commit is contained in:
@@ -130,9 +130,15 @@ public class TLWMatchdaysCreator {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
deliveryDates.add(firstMatchDate.format(formatter));
|
||||
|
||||
ArrayList<TLWMatch> remainingMatches = TLWMatchesManagerBase.getMatchesStartingFromSecondDay(matchesOfMatchday);
|
||||
if(remainingMatches.size() > 0) {
|
||||
firstMatchDate = TLWMatchesManagerBase.getFirstMatchtimeTLW(remainingMatches);
|
||||
ArrayList<TLWMatch> matchesSecondDay = TLWMatchesManagerBase.getMatchesStartingFromSecondDay(matchesOfMatchday);
|
||||
if(matchesSecondDay.size() > 0) {
|
||||
firstMatchDate = TLWMatchesManagerBase.getFirstMatchtimeTLW(matchesSecondDay);
|
||||
deliveryDates.add(firstMatchDate.format(formatter));
|
||||
}
|
||||
|
||||
ArrayList<TLWMatch> matchesSecondWeek = TLWMatchesManagerBase.getMatchesStartingFromSecondWeek(matchesOfMatchday);
|
||||
if(matchesSecondWeek.size() > 0) {
|
||||
firstMatchDate = TLWMatchesManagerBase.getFirstMatchtimeTLW(matchesSecondWeek);
|
||||
deliveryDates.add(firstMatchDate.format(formatter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,14 @@ public class TLWMatchdaysUpdater {
|
||||
"Tippabgabeschluss 2 zu '" + matchdayUpdated.getDeliveryDate2() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchdayOriginal.getDeliveryDate3().equals(matchdayUpdated.getDeliveryDate3())) {
|
||||
updateSql += updateStart +
|
||||
"delivery_date_3 = '" + matchdayUpdated.getDeliveryDate3() + "' " +
|
||||
condition;
|
||||
this.beautifulInfo += beautifulInfoStart +
|
||||
"Tippabgabeschluss 3 zu '" + matchdayUpdated.getDeliveryDate3() + "'.\n";
|
||||
}
|
||||
|
||||
if (!matchdayOriginal.getMatchdayName().equals(matchdayUpdated.getMatchdayName())) {
|
||||
updateSql += updateStart +
|
||||
"matchday_name = '" + matchdayUpdated.getMatchdayName() + "' " +
|
||||
|
||||
@@ -41,6 +41,18 @@ public class TLWMatchesManagerBase {
|
||||
return filteredMatches;
|
||||
}
|
||||
|
||||
public static ArrayList<TLWMatch> getMatchesStartingFromSecondWeek(ArrayList<TLWMatch> matches) {
|
||||
LocalDateTime firstMatchtime = getFirstMatchtimeTLW(matches);
|
||||
ArrayList<TLWMatch> filteredMatches = new ArrayList<>();
|
||||
for(TLWMatch match : matches) {
|
||||
LocalDateTime matchDateTime = getDate(match);
|
||||
if(getDaysDifference(matchDateTime, firstMatchtime) > 6) {
|
||||
filteredMatches.add(match);
|
||||
}
|
||||
}
|
||||
return filteredMatches;
|
||||
}
|
||||
|
||||
public static LocalDateTime getFirstMatchtimeTLW(ArrayList<TLWMatch> matches) {
|
||||
LocalDateTime matchtime = null;
|
||||
for(TLWMatch match : matches) {
|
||||
|
||||
Reference in New Issue
Block a user