|
|
@@ -177,20 +177,20 @@ import tests.objects.Standing;
|
|
|
}
|
|
|
|
|
|
@FXML private void countrySelected(ActionEvent event) {
|
|
|
- if (getCountryIdFromSelector() != null) {
|
|
|
+ if (getCountryIdFromSelector() > 0) {
|
|
|
getLeaguesAtDate(getCountryIdFromSelector());
|
|
|
leagueSelector.setDisable(false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private Integer getCountryIdFromSelector() {
|
|
|
+ private int getCountryIdFromSelector() {
|
|
|
Optional<SimpleEntry<Integer, String>> o = countriesList.stream().filter(p -> p.getValue().equals(countrySelector.getValue())).findFirst();
|
|
|
- return o.isPresent() ? o.get().getKey() : null;
|
|
|
+ return o.isPresent() ? o.get().getKey() : -1;
|
|
|
}
|
|
|
|
|
|
- private Integer getLeagueIdFromSelector() {
|
|
|
+ private int getLeagueIdFromSelector() {
|
|
|
Optional<SimpleEntry<Integer, String>> o = leaguesList.stream().filter(p -> p.getValue().equals(leagueSelector.getValue())).findFirst();
|
|
|
- return o.isPresent() ? o.get().getKey() : null;
|
|
|
+ return o.isPresent() ? o.get().getKey() : -1;
|
|
|
}
|
|
|
|
|
|
private float getAvgGoalsWithSameDiff(int countryId, int leagueId, int placementDiff) {
|
|
|
@@ -270,7 +270,7 @@ import tests.objects.Standing;
|
|
|
|
|
|
@FXML private void leagueSelected(ActionEvent event) {
|
|
|
updateStandingsTable();
|
|
|
- if (getCountryIdFromSelector() != null) {
|
|
|
+ if (getCountryIdFromSelector() > 0) {
|
|
|
List<SoccerMatch> matchesList = db.getMatches(db.getSportId(MainController.SOCCER), getCountryIdFromSelector(),
|
|
|
db.getLeagueId(db.getSportId(MainController.SOCCER), getCountryIdFromSelector(), leagueSelector.getValue()),
|
|
|
date.getValue().toString(), "ASC", true);
|
|
|
@@ -363,9 +363,11 @@ import tests.objects.Standing;
|
|
|
}
|
|
|
|
|
|
@FXML private void updateStandingsTable() {
|
|
|
- String seasonFromDate = GuiMysql.getInstance().getSeasonFromDate(getCountryIdFromSelector(), getLeagueIdFromSelector(),
|
|
|
- date.getValue().toString());
|
|
|
- MatchStatTabController.getInstance().setLeagueStandingsTable(getLeagueIdFromSelector(), seasonFromDate, getCountryIdFromSelector(),
|
|
|
- date.getValue().toString());
|
|
|
+ int countryId = getCountryIdFromSelector();
|
|
|
+ if (countryId > 0) {
|
|
|
+ String seasonFromDate = GuiMysql.getInstance().getSeasonFromDate(countryId, getLeagueIdFromSelector(), date.getValue().toString());
|
|
|
+ MatchStatTabController.getInstance().setLeagueStandingsTable(getLeagueIdFromSelector(), seasonFromDate, countryId,
|
|
|
+ date.getValue().toString());
|
|
|
+ }
|
|
|
}
|
|
|
}
|