Sfoglia il codice sorgente

Start of Kelly Kriterion calculations

Axel Nordh 3 anni fa
parent
commit
e7ffea2aa4

+ 0 - 1
Odds/src/parser/OddsPortal.java

@@ -81,7 +81,6 @@ public class OddsPortal implements ParserJoinedFunctions {
 			System.out.println("Webclient failed " + e.getMessage());
 			e.printStackTrace();
 		}
-//		webClient.close();
 	}
 
 	private void parseSoccerMatches(final String soccerUrl, final WebClient webClient, String date) {

+ 5 - 0
OddsJavaFx/src/controllers/MatchTabController.java

@@ -33,6 +33,7 @@ import javafx.scene.control.TableCell;
 import javafx.scene.control.TableColumn;
 import javafx.scene.control.TablePosition;
 import javafx.scene.control.TableView;
+import javafx.scene.control.TextField;
 import javafx.scene.control.cell.MapValueFactory;
 import javafx.scene.control.cell.PropertyValueFactory;
 import javafx.scene.control.cell.TextFieldTableCell;
@@ -68,6 +69,10 @@ import objects.TeamResults;
 	@FXML TableColumn<Map, String> awayWinColumn = new TableColumn<>(Constants.AWAY_WIN);
 	@FXML TableColumn<Map, String> scoringScore = new TableColumn<>("scoringScore");
 
+	@FXML TableColumn<Map, TextField> ownOddsPerdiction = new TableColumn<>("ownOdds");
+	@FXML TableColumn<Map, TextField> givenOdds = new TableColumn<>("givenOdds");
+	@FXML TableColumn<Map, String> percentageToBet = new TableColumn<>("toBetPercent");
+
 	@FXML TableColumn<Map, Boolean> addToBetSlip = new TableColumn<>("addToBetslip");
 
 	@FXML private TableView<BetDTO> activeBettingTable;

+ 294 - 67
OddsJavaFx/src/controllers/PastResultsController.java

@@ -8,14 +8,18 @@ import java.time.format.DateTimeFormatter;
 import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.NotImplementedException;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 import data.GuiMysql;
 import javafx.collections.FXCollections;
@@ -23,13 +27,18 @@ import javafx.collections.ObservableList;
 import javafx.event.ActionEvent;
 import javafx.fxml.FXML;
 import javafx.fxml.Initializable;
+import javafx.scene.control.Button;
 import javafx.scene.control.ComboBox;
 import javafx.scene.control.DatePicker;
+import javafx.scene.control.Label;
+import javafx.scene.control.TableCell;
 import javafx.scene.control.TableColumn;
 import javafx.scene.control.TableView;
+import javafx.scene.control.TextArea;
 import javafx.scene.control.cell.MapValueFactory;
 import javafx.scene.layout.AnchorPane;
 import javafx.scene.text.Text;
+import javafx.util.Callback;
 import objects.Constants;
 import objects.SoccerMatch;
 import tests.objects.Standing;
@@ -64,13 +73,18 @@ import tests.objects.Standing;
 
 	@FXML TableColumn<Map, String> sumScoringColumn = new TableColumn<>("Sum scoring");
 	@FXML TableColumn<Map, Float> positionAdjustmentColumn = new TableColumn<>("PositionAdjustment");
-	@FXML TableColumn<Map, String> awayWinColumn = new TableColumn<>(Constants.AWAY_WIN);
+	@FXML TableColumn<Map, String> newScoringTestColumn = new TableColumn<>("New Scoring test");
+	@FXML TableColumn<Map, Void> addToBetsButtonColumn = new TableColumn<>("Add bet");
 
 	@FXML Text homeTeamPastResultsText;
 	@FXML Text awayTeamPastResultsText;
 	@FXML Text previousMeetingsText;
 	@FXML Text previousReverseMeetingsText;
 
+	@FXML Label NumberOfGamesText;
+	@FXML TextArea SystemsText;
+	@FXML Label ReslutsText;
+
 	ObservableList<String> sports = FXCollections.observableArrayList();
 	ObservableList<String> countries = FXCollections.observableArrayList();
 	ObservableList<String> leagues = FXCollections.observableArrayList();
@@ -83,6 +97,8 @@ import tests.objects.Standing;
 	private String selectedHomeTeam;
 	private String selectedAwayTeam;
 
+	Set<betSystemDTO> bets = new HashSet<>();
+
 	@Override public void initialize(URL arg0, ResourceBundle arg1) {
 		gameDateColumn.setCellValueFactory(new MapValueFactory<>("gameDate"));
 		homeTeamColumn.setCellValueFactory(new MapValueFactory<>("homeTeam"));
@@ -105,7 +121,34 @@ import tests.objects.Standing;
 
 		sumScoringColumn.setCellValueFactory(new MapValueFactory<>("sumScoring"));
 		positionAdjustmentColumn.setCellValueFactory(new MapValueFactory<>("positionAdjustment"));
-		awayWinColumn.setCellValueFactory(new MapValueFactory<>(Constants.AWAY_WIN));
+		newScoringTestColumn.setCellValueFactory(new MapValueFactory<>("newScoringTest"));
+
+		Callback<TableColumn<Map, Void>, TableCell<Map, Void>> cellFactory = new Callback<TableColumn<Map, Void>, TableCell<Map, Void>>() {
+			@Override public TableCell<Map, Void> call(final TableColumn<Map, Void> param) {
+				return new TableCell<Map, Void>() {
+
+					private final Button btn = new Button("Submit");
+					{
+						btn.setOnAction((ActionEvent event) -> {
+							Map data = getTableView().getItems().get(getIndex());
+
+							addToBets(data);
+						});
+					}
+
+					@Override public void updateItem(Void item, boolean empty) {
+						super.updateItem(item, empty);
+						if (empty) {
+							setGraphic(null);
+						} else {
+							setGraphic(btn);
+						}
+					}
+				};
+			}
+		};
+
+		addToBetsButtonColumn.setCellFactory(cellFactory);
 
 		basePane.setPrefWidth(0.0);
 		basePane.setPrefHeight(0.0);
@@ -131,6 +174,51 @@ import tests.objects.Standing;
 		});
 	}
 
+	public void addToBets(Map data) {
+		String betType;
+		if (Float.valueOf(data.get("sumScoring").toString()) > 5.0f && Float.valueOf(data.get("newScoringTest").toString()) > 6.5f) {
+			betType = "O 1.5";
+		} else if (Float.valueOf(data.get("sumScoring").toString()) < 2.0f && Float.valueOf(data.get("newScoringTest").toString()) < 3.5f) {
+			betType = "U 3.5";
+		} else if (Float.valueOf(data.get("sumScoring").toString()) < 3.0f && Float.valueOf(data.get("newScoringTest").toString()) < 4.5f) {
+			betType = "U 4.5";
+		} else {
+			return;
+		}
+
+		bets.add(new betSystemDTO(Integer.valueOf(data.get("id").toString()), Integer.valueOf(data.get("homeScore").toString()),
+				Integer.valueOf(data.get("awayScore").toString()), betType));
+		increaseNumberOfBets();
+		calculateSystems();
+	}
+
+	private void increaseNumberOfBets() {
+		NumberOfGamesText.setText(String.valueOf(Integer.valueOf(NumberOfGamesText.getText()) + 1));
+	}
+
+	private void calculateSystems() {
+		Set<Set<betSystemDTO>> combinations = Sets.powerSet(bets);
+
+		combinations = combinations.stream().sorted((s1, s2) -> Integer.compare(s1.size(), s2.size())).collect(Collectors.toSet());
+
+		String combinationText = "";
+		int totalCombinations = 0;
+		Map<Integer, Integer> sets = new HashMap<>();
+		for (Set<betSystemDTO> set : combinations) {
+			if (set.size() > 0) {
+				totalCombinations += set.size();
+				sets.put(set.size(), sets.getOrDefault(set.size(), 0) + 1);
+			}
+		}
+
+		String text = "Total Combinations: " + sets.values().stream().mapToInt(Integer::intValue).sum() + "\n";
+		StringBuilder sb = new StringBuilder();
+		sets.forEach((k, v) -> sb.append(k.toString() + "'s: " + v.toString() + "\n"));
+
+		text += sb.toString();
+		SystemsText.setText(text);
+	}
+
 	private void updateMatchStats(Map<String, Object> newSelection) {
 		if (newSelection != null) {
 			Map<String, String> previousMatches = db.getPreviousMatches(5, newSelection.get("homeTeam").toString(),
@@ -198,8 +286,11 @@ import tests.objects.Standing;
 		float result = 0.0f;
 		int matchedMatches = 0;
 
-		List<SoccerMatch> matchesBefore = GuiMysql.getInstance().getMatches(1, getCountryIdFromSelector(), getLeagueIdFromSelector(),
-				date.getValue().toString(), "ASC", false);
+		if (placementDiff == 0) {
+			return 0f;
+		}
+
+		List<SoccerMatch> matchesBefore = GuiMysql.getInstance().getMatches(1, countryId, leagueId, date.getValue().toString(), "ASC", false, false);
 
 		for (SoccerMatch match : matchesBefore) {
 			Optional<Standing> homeTeamStanding = tempStanding.stream().filter(ts -> ts.getTeamName().equals(match.getHomeTeam().getTeamName()))
@@ -273,73 +364,86 @@ import tests.objects.Standing;
 		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);
-
-			ObservableList<Map<String, Object>> matches = FXCollections.<Map<String, Object>>observableArrayList();
-
-			for (final SoccerMatch soccerMatch : matchesList) {
-
-				final Map<String, Object> match = new HashMap<>();
-				match.put("homeTeam", soccerMatch.getHomeTeam().getTeamName());
-				match.put("awayTeam", soccerMatch.getAwayTeam().getTeamName());
-				match.put("odds1", soccerMatch.getOdds1());
-				match.put("oddsX", soccerMatch.getOddsX());
-				match.put("odds2", soccerMatch.getOdds2());
-
-				final List<Float> avgHomeTeamGoals = calculateAvgHomeScore(soccerMatch.getHomeTeam().getTeamId());
-				final List<Float> avgAwayTeamGoals = calculateAvgAwayScore(soccerMatch.getAwayTeam().getTeamId());
-
-				final List<Float> avgHomeTeamGoalsThisSeason = calculateAvgHomeScoreThisSeason(soccerMatch.getHomeTeam().getTeamId(),
-						soccerMatch.getHomeTeam().getCountryId(), soccerMatch.getHomeTeam().getTeamLeagueId());
-				final List<Float> avgAwayTeamGoalsThisSeason = calculateAvgAwayScoreThisSeason(soccerMatch.getAwayTeam().getTeamId(),
-						soccerMatch.getAwayTeam().getCountryId(), soccerMatch.getAwayTeam().getTeamLeagueId());
-
-				match.put("gameDate", soccerMatch.getGameDate().toString());
-				match.put("avgScoreHome", avgHomeTeamGoals.get(0));
-				match.put("avgConcededHome", avgHomeTeamGoals.get(1));
-				match.put("avgScoreAway", avgAwayTeamGoals.get(0));
-				match.put("avgConcededAway", avgAwayTeamGoals.get(1));
-
-				match.put("avgScoredHomeSeason", avgHomeTeamGoalsThisSeason.get(0));
-				match.put("avgConcededHomeSeason", avgHomeTeamGoalsThisSeason.get(1));
-
-				match.put("avgScoredAwaySeason", avgAwayTeamGoalsThisSeason.get(0));
-				match.put("avgConcededAwaySeason", avgAwayTeamGoalsThisSeason.get(1));
-
-				match.put("sumScoring", avgHomeTeamGoalsThisSeason.get(0) * avgAwayTeamGoalsThisSeason.get(1)
-						+ avgAwayTeamGoalsThisSeason.get(0) * avgHomeTeamGoalsThisSeason.get(1));
-
-				match.put("goalsHome",
-						GuiMysql.getInstance().round(BigDecimal.valueOf(avgHomeTeamGoalsThisSeason.get(0) + avgAwayTeamGoalsThisSeason.get(1)),
-								GuiMysql.getInstance().getIncrement(), RoundingMode.HALF_UP));
-				match.put("goalsAway",
-						GuiMysql.getInstance().round(BigDecimal.valueOf(avgAwayTeamGoalsThisSeason.get(0) + avgHomeTeamGoalsThisSeason.get(1)),
-								GuiMysql.getInstance().getIncrement(), RoundingMode.HALF_UP));
-
-				match.put("goalDiff",
-						GuiMysql.getInstance()
-								.round(BigDecimal.valueOf((avgHomeTeamGoalsThisSeason.get(0) * avgAwayTeamGoalsThisSeason.get(1))
-										+ (avgAwayTeamGoalsThisSeason.get(0) * avgHomeTeamGoalsThisSeason.get(1))),
-										GuiMysql.getInstance().getIncrement(), RoundingMode.HALF_UP));
-				match.put("country", soccerMatch.getHomeTeam().getCountryName());
-
-				List<Float> leagueAvarages = GuiMysql.getInstance().getLeagueAvarages(getLeagueIdFromSelector(), getCountryIdFromSelector(),
-						soccerMatch.getGameDate().format(DateTimeFormatter.BASIC_ISO_DATE));
-				match.put("positionAdjustment", getAvgGoalsWithSameDiff(soccerMatch.getHomeTeam().getCountryId(),
-						soccerMatch.getHomeTeam().getTeamLeagueId(), MatchStatTabController.getInstance()
-								.getTeamPositionDiff(soccerMatch.getHomeTeam().getTeamName(), soccerMatch.getAwayTeam().getTeamName()))
-						- (leagueAvarages.get(0) + leagueAvarages.get(1)));
-				match.put(Constants.LEAGUE, soccerMatch.getHomeTeam().getTeamLeague());
-
-				final DecimalFormat df = new DecimalFormat("#.##");
-				df.setRoundingMode(RoundingMode.CEILING);
+					date.getValue().toString(), "ASC", true, false);
+
+			addMatchesToTable(matchesList);
+		}
+	}
+
+	private void addMatchesToTable(List<SoccerMatch> matchesList) {
+		ObservableList<Map<String, Object>> matches = FXCollections.<Map<String, Object>>observableArrayList();
+
+		for (final SoccerMatch soccerMatch : matchesList) {
+
+			final Map<String, Object> match = new HashMap<>();
+			match.put("homeTeam", soccerMatch.getHomeTeam().getTeamName());
+			match.put("awayTeam", soccerMatch.getAwayTeam().getTeamName());
+			match.put("odds1", soccerMatch.getOdds1());
+			match.put("oddsX", soccerMatch.getOddsX());
+			match.put("odds2", soccerMatch.getOdds2());
+
+			final List<Float> avgHomeTeamGoals = calculateAvgHomeScore(soccerMatch.getHomeTeam().getTeamId());
+			final List<Float> avgAwayTeamGoals = calculateAvgAwayScore(soccerMatch.getAwayTeam().getTeamId());
+
+			final List<Float> avgHomeTeamGoalsThisSeason = calculateAvgHomeScoreThisSeason(soccerMatch.getHomeTeam().getTeamId(),
+					soccerMatch.getHomeTeam().getCountryId(), soccerMatch.getHomeTeam().getTeamLeagueId());
+			final List<Float> avgAwayTeamGoalsThisSeason = calculateAvgAwayScoreThisSeason(soccerMatch.getAwayTeam().getTeamId(),
+					soccerMatch.getAwayTeam().getCountryId(), soccerMatch.getAwayTeam().getTeamLeagueId());
+
+			match.put("gameDate", soccerMatch.getGameDate().toString());
+			match.put("avgScoreHome", avgHomeTeamGoals.get(0));
+			match.put("avgConcededHome", avgHomeTeamGoals.get(1));
+			match.put("avgScoreAway", avgAwayTeamGoals.get(0));
+			match.put("avgConcededAway", avgAwayTeamGoals.get(1));
+
+			match.put("avgScoredHomeSeason", avgHomeTeamGoalsThisSeason.get(0));
+			match.put("avgConcededHomeSeason", avgHomeTeamGoalsThisSeason.get(1));
+
+			match.put("avgScoredAwaySeason", avgAwayTeamGoalsThisSeason.get(0));
+			match.put("avgConcededAwaySeason", avgAwayTeamGoalsThisSeason.get(1));
+
+			match.put("sumScoring", avgHomeTeamGoalsThisSeason.get(0) * avgAwayTeamGoalsThisSeason.get(1)
+					+ avgAwayTeamGoalsThisSeason.get(0) * avgHomeTeamGoalsThisSeason.get(1));
+
+			match.put("goalsHome",
+					GuiMysql.getInstance().round(BigDecimal.valueOf(avgHomeTeamGoalsThisSeason.get(0) + avgAwayTeamGoalsThisSeason.get(1)),
+							GuiMysql.getInstance().getIncrement(), RoundingMode.HALF_UP));
+			match.put("goalsAway",
+					GuiMysql.getInstance().round(BigDecimal.valueOf(avgAwayTeamGoalsThisSeason.get(0) + avgHomeTeamGoalsThisSeason.get(1)),
+							GuiMysql.getInstance().getIncrement(), RoundingMode.HALF_UP));
+
+			match.put("goalDiff",
+					GuiMysql.getInstance()
+							.round(BigDecimal.valueOf((avgHomeTeamGoalsThisSeason.get(0) * avgAwayTeamGoalsThisSeason.get(1))
+									+ (avgAwayTeamGoalsThisSeason.get(0) * avgHomeTeamGoalsThisSeason.get(1))), GuiMysql.getInstance().getIncrement(),
+									RoundingMode.HALF_UP));
+			match.put("country", soccerMatch.getHomeTeam().getCountryName());
+
+			List<Float> leagueAvarages = GuiMysql.getInstance().getLeagueAvarages(getLeagueIdFromSelector(), getCountryIdFromSelector(),
+					soccerMatch.getGameDate().format(DateTimeFormatter.BASIC_ISO_DATE));
+			match.put("positionAdjustment", getAvgGoalsWithSameDiff(soccerMatch.getHomeTeam().getCountryId(),
+					soccerMatch.getHomeTeam().getTeamLeagueId(), MatchStatTabController.getInstance()
+							.getTeamPositionDiff(soccerMatch.getHomeTeam().getTeamName(), soccerMatch.getAwayTeam().getTeamName()))
+					- (leagueAvarages.get(0) + leagueAvarages.get(1)));
+
+			match.put("newScoringTest",
+					(avgHomeTeamGoalsThisSeason.get(0) * avgAwayTeamGoalsThisSeason.get(1)
+							+ avgAwayTeamGoalsThisSeason.get(0) * avgHomeTeamGoalsThisSeason.get(1))
+							+ ((avgHomeTeamGoals.get(0) * avgAwayTeamGoals.get(1)) + avgAwayTeamGoals.get(0) * avgHomeTeamGoals.get(1)) / 2);
+
+			match.put(Constants.LEAGUE, soccerMatch.getHomeTeam().getTeamLeague());
+
+			match.put("id", soccerMatch.getMatchId());
+			match.put("homeScore", soccerMatch.getHomeScore());
+			match.put("awayScore", soccerMatch.getAwayScore());
+			final DecimalFormat df = new DecimalFormat("#.##");
+			df.setRoundingMode(RoundingMode.CEILING);
 
 //			final League leagueInfo = GuiMysql.getInstance().getLeagueInfo(soccerMatch.getHomeTeam().getTeamLeague());
 
-				matches.add(match);
-			}
-			matchTable.getItems().addAll(matches);
+			matches.add(match);
 		}
+		matchTable.getItems().addAll(matches);
 	}
 
 	private List<Float> calculateAvgHomeScore(int teamId) {
@@ -370,4 +474,127 @@ import tests.objects.Standing;
 					date.getValue().toString());
 		}
 	}
+
+	@FXML private void getAllMatchesAtDate() {
+		String dateString = date.getValue().toString();
+
+		List<SoccerMatch> matches = GuiMysql.getInstance().getMatches(1, dateString, "ASC", true);
+		addMatchesToTable(matches);
+	}
+
+	@FXML private void ClearBetSlip() {
+		NumberOfGamesText.setText("0");
+		SystemsText.setText("");
+		ReslutsText.setText("");
+		bets.clear();
+	}
+
+	@FXML private void CheckBetSlip() {
+		Set<Set<betSystemDTO>> combinations = Sets.powerSet(bets);
+
+		Map<Integer, Integer> resultWins = new HashMap<>();
+		Map<Integer, Integer> resultLosses = new HashMap<>();
+
+		int setTest = 0;
+		double betAmount = 10.0d;
+
+		Map<Integer, Double> banks = new HashMap<>();
+
+		for (Set<betSystemDTO> set : combinations) {
+			if (set.size() > 0) {
+				System.out.println("Set " + ++setTest);
+				if (set.stream().allMatch(this::isWin)) {
+					resultWins.put(set.size(), resultWins.getOrDefault(set.size(), 0) + 1);
+					set.forEach(s -> {
+						System.out.println(
+								"WIN size " + set.size() + " GameId: " + s.getGameId() + " Score " + s.getHomeScore() + " - " + s.getAwayScore());
+						banks.put(set.size(), banks.getOrDefault(set.size(), 0d) + ((betAmount * Math.pow(1.15d, set.size())) - betAmount));
+					});
+
+				} else { // Set/combination lost
+					resultLosses.put(set.size(), resultLosses.getOrDefault(set.size(), 0) + 1);
+					set.forEach(s -> System.out.println("LOSS size " + set.size() + " GameId: " + s.getGameId() + " Score " + s.getHomeScore() + " - "
+							+ s.getAwayScore() + " type " + s.getBetType()));
+					banks.put(set.size(), banks.getOrDefault(set.size(), 0d) - betAmount);
+				}
+			}
+		}
+
+		StringBuilder losses = new StringBuilder();
+		StringBuilder wins = new StringBuilder();
+		StringBuilder bankString = new StringBuilder();
+
+		resultLosses.forEach((k, v) -> losses.append("Set size: " + k + " number of losses: " + v + "\n"));
+		resultWins.forEach((k, v) -> wins.append("Set size: " + k + " number of Wins: " + v + "\n"));
+		banks.forEach((k, v) -> bankString.append("Set " + k + " result " + v + "\n"));
+
+		System.out.println("Results \n WINS \n" + wins.toString() + "\nLOSSES\n" + losses.toString() + "\nBanks:" + bankString);
+	}
+
+	public boolean isWin(betSystemDTO bet) {
+		boolean result = false;
+		String betType = bet.getBetType();
+		String overUnder = betType.substring(0, 1);
+		float res = Float.valueOf(betType.substring(2, betType.length()));
+		int gameGoals = bet.getHomeScore() + bet.getAwayScore();
+
+		if (overUnder.equals("O")) {
+			if (gameGoals > res) {
+				result = true;
+			}
+		} else if (overUnder.equals("U")) {
+			if (gameGoals < res) {
+				result = true;
+			}
+		}
+		return result;
+	}
+
+	class betSystemDTO {
+		int gameId;
+		int homeScore;
+		int awayScore;
+		String betType;
+
+		public betSystemDTO(int gameId, int homeScore, int awayScore, String betType) {
+			super();
+			this.gameId = gameId;
+			this.homeScore = homeScore;
+			this.awayScore = awayScore;
+			this.betType = betType;
+		}
+
+		public int getGameId() {
+			return gameId;
+		}
+
+		public void setGameId(int gameId) {
+			this.gameId = gameId;
+		}
+
+		public int getHomeScore() {
+			return homeScore;
+		}
+
+		public void setHomeScore(int homeScore) {
+			this.homeScore = homeScore;
+		}
+
+		public int getAwayScore() {
+			return awayScore;
+		}
+
+		public void setAwayScore(int awayScore) {
+			this.awayScore = awayScore;
+		}
+
+		public String getBetType() {
+			return betType;
+		}
+
+		public void setBetType(String betType) {
+			this.betType = betType;
+		}
+
+	}
 }

+ 36 - 9
OddsJavaFx/src/data/GuiMysql.java

@@ -34,9 +34,6 @@ import objects.TeamStanding;
 
 public class GuiMysql extends Mysql {
 
-	/**
-	 *
-	 */
 	private static final BigDecimal INCREMENT = BigDecimal.valueOf(0.2);
 	private static final GuiMysql instance = new GuiMysql();
 	private final Connection conn;
@@ -616,7 +613,8 @@ public class GuiMysql extends Mysql {
 		return leagues;
 	}
 
-	public List<SoccerMatch> getMatches(int sportId, Integer countryId, Integer leagueId, String date, String order, boolean exactDate) {
+	public List<SoccerMatch> getMatches(int sportId, Integer countryId, Integer leagueId, String date, String order, boolean exactDate,
+			boolean onlyPrio) {
 		final ArrayList<SoccerMatch> matches = Lists.newArrayList();
 		final String dateSql;
 		final String orderSql = " ORDER BY gameDate " + order;
@@ -629,13 +627,38 @@ public class GuiMysql extends Mysql {
 				dateSql = "DATE(gameDate) <= '" + date + "' ";
 			}
 		}
-		final String sql = "SELECT res.*, " + "hTeam.name as homeTeamName, aTeam.name as awayTeamName " + "FROM SoccerResults as res "
-				+ "Join Team as hTeam ON res.homeTeamId = hTeam.id " + "Join Team as aTeam ON res.awayTeamId = aTeam.id " + "WHERE " + dateSql
-				+ "AND res.leagueId = ? " + "AND res.countryId = ? " + orderSql;
+		final String countrySql;
+		if (countryId != null) {
+			countrySql = "AND res.countryId = ? ";
+		} else {
+			countrySql = "";
+		}
+		final String leagueSql;
+		if (leagueId != null) {
+			leagueSql = "AND res.leagueId = ? ";
+		} else {
+			leagueSql = "";
+		}
+		final String onlyPrioSql;
+		if (onlyPrio) {
+			onlyPrioSql = "AND l.prio = 1 ";
+		} else {
+			onlyPrioSql = "";
+		}
 
+		final String sql = "SELECT res.*, " + "hTeam.name as homeTeamName, aTeam.name as awayTeamName " + "FROM SoccerResults as res "
+				+ "Join Team as hTeam ON res.homeTeamId = hTeam.id "
+				+ "Join Team as aTeam ON res.awayTeamId = aTeam.id INNER JOIN League l ON res.leagueId = l.id " + "WHERE " + dateSql + leagueSql
+				+ countrySql + onlyPrioSql + orderSql;
 		try (PreparedStatement stat = conn.prepareStatement(sql)) {
-			stat.setInt(1, leagueId);
-			stat.setInt(2, countryId);
+			if (leagueId != null && countryId != null) {
+				stat.setInt(1, leagueId);
+				stat.setInt(2, countryId);
+			} else if (leagueId != null && countryId == null) {
+				stat.setInt(1, leagueId);
+			} else if (leagueId == null && countryId != null) {
+				stat.setInt(1, countryId);
+			}
 
 			final ResultSet rs = stat.executeQuery();
 			while (rs.next()) {
@@ -972,4 +995,8 @@ public class GuiMysql extends Mysql {
 
 		return result;
 	}
+
+	public List<SoccerMatch> getMatches(int sportId, String dateString, String sortOrder, boolean exactDate) {
+		return getMatches(sportId, null, null, dateString, sortOrder, exactDate, true);
+	}
 }

+ 54 - 47
OddsJavaFx/src/fxml/MatchTabBuilder.fxml

@@ -7,52 +7,59 @@
 <?import javafx.scene.layout.AnchorPane?>
 <?import javafx.scene.layout.HBox?>
 <?import javafx.scene.text.Text?>
+<?import javafx.scene.layout.VBox?>
 
-<AnchorPane xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.MatchTabController">
-	<children>
-      <SplitPane dividerPositions="0.7305764411027569" orientation="VERTICAL" prefHeight="800.0" prefWidth="1000.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
-        <items>
-          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="700.0" prefWidth="1000.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
-               <children>
-            	   <TableView fx:id="matchTable" prefHeight="580.0" prefWidth="1427.0">
-            	     <columns>
-            	       <TableColumn fx:id="gameDateColumn" editable="false" prefWidth="75.0" text="Game date" />
-            	       <TableColumn fx:id="homeTeamColumn" editable="false" prefWidth="75.0" text="Home team" />
-            	       <TableColumn fx:id="awayTeamColumn" prefWidth="75.0" text="Away team" />
-            	       <TableColumn fx:id="odds1Column" prefWidth="75.0" text="Odds 1" />
-            	       <TableColumn fx:id="oddsXColumn" prefWidth="75.0" text="Odds X" />
-            	       <TableColumn fx:id="odds2Column" prefWidth="75.0" text="Odds 2" />
-            	       <TableColumn fx:id="goalsHomeColumn" prefWidth="75.0" text="Goals home" />
-            	       <TableColumn fx:id="goalsAwayColumn" prefWidth="75.0" text="Goals away" />
-            	       <TableColumn fx:id="goalDiff" prefWidth="75.0" text="Difference" />
-            	       <TableColumn fx:id="avgScoreHomeColumn" prefWidth="75.0" text="Avg score home" />
-            	       <TableColumn fx:id="avgConcededHomeColumn" prefWidth="75.0" text="Avg conceded home" />
-            	       <TableColumn fx:id="avgScoreAwayColumn" prefWidth="75.0" text="Avg score away" />
-            	       <TableColumn fx:id="avgConcededAwayColumn" prefWidth="75.0" text="Avg conceded away" />
-            	       <TableColumn fx:id="countryColumn" prefWidth="75.0" text="Country" />
-            	       <TableColumn fx:id="leagueColumn" prefWidth="75.0" text="League" />
-            	       
-            	       <TableColumn fx:id="homeWinColumn" prefWidth="75.0" text="Home Win" />
-            	       <TableColumn fx:id="drawColumn" prefWidth="75.0" text="Draw" />
-            	       <TableColumn fx:id="awayWinColumn" prefWidth="75.0" text="Away win" />
-            	       <TableColumn fx:id="scoringScore" prefWidth="75.0" text="Scoring score" />
-            	     </columns>
-            	   </TableView>
-               </children>
-            </AnchorPane>
-          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="229.0" prefWidth="998.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
-               <children>
-                  <HBox prefHeight="23.0" prefWidth="998.0">
-                     <children>
-                        <Button mnemonicParsing="false" onAction="#addRowAction" text="Add New Row" />
-                        <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Över 1.5 om score &gt; 5 och under 4.5 om score &lt; 3" wrappingWidth="303.486328125" />
-                     </children>
-                  </HBox>
-               
-                  <TableView fx:id="activeBettingTable" layoutY="25.0" prefHeight="189.0" prefWidth="998.0" />
-               </children>
-            </AnchorPane>
-        </items>
-      </SplitPane>
-	</children>
+<AnchorPane xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1"
+  fx:controller="controllers.MatchTabController">
+  <children>
+    <SplitPane dividerPositions="0.7305764411027569" orientation="VERTICAL" prefHeight="800.0" prefWidth="1000.0"
+      AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+      <items>
+        <VBox alignment="center" minHeight="0.0" minWidth="0.0" prefHeight="700.0" prefWidth="1000.0">
+          <children>
+            <TableView fx:id="matchTable" prefHeight="580.0" prefWidth="1427.0">
+              <columns>
+                <TableColumn fx:id="gameDateColumn" editable="false" prefWidth="75.0" text="Game date" />
+                <TableColumn fx:id="homeTeamColumn" editable="false" prefWidth="75.0" text="Home team" />
+                <TableColumn fx:id="awayTeamColumn" prefWidth="75.0" text="Away team" />
+                <TableColumn fx:id="odds1Column" prefWidth="75.0" text="Odds 1" />
+                <TableColumn fx:id="oddsXColumn" prefWidth="75.0" text="Odds X" />
+                <TableColumn fx:id="odds2Column" prefWidth="75.0" text="Odds 2" />
+                <TableColumn fx:id="goalsHomeColumn" prefWidth="75.0" text="Goals home" />
+                <TableColumn fx:id="goalsAwayColumn" prefWidth="75.0" text="Goals away" />
+                <TableColumn fx:id="goalDiff" prefWidth="75.0" text="Difference" />
+                <TableColumn fx:id="avgScoreHomeColumn" prefWidth="75.0" text="Avg score home" />
+                <TableColumn fx:id="avgConcededHomeColumn" prefWidth="75.0" text="Avg conceded home" />
+                <TableColumn fx:id="avgScoreAwayColumn" prefWidth="75.0" text="Avg score away" />
+                <TableColumn fx:id="avgConcededAwayColumn" prefWidth="75.0" text="Avg conceded away" />
+                <TableColumn fx:id="countryColumn" prefWidth="75.0" text="Country" />
+                <TableColumn fx:id="leagueColumn" prefWidth="75.0" text="League" />
+
+                <TableColumn fx:id="homeWinColumn" prefWidth="75.0" text="Home Win" />
+                <TableColumn fx:id="drawColumn" prefWidth="75.0" text="Draw" />
+                <TableColumn fx:id="awayWinColumn" prefWidth="75.0" text="Away win" />
+                <TableColumn fx:id="scoringScore" prefWidth="75.0" text="Scoring score" />
+                <TableColumn fx:id="ownOddsPerdiction" text="Calculated Odds"/>
+                <TableColumn fx:id="givenOdds" text="Given Odds"/>
+                <TableColumn fx:id="percentageToBet" text="Percentage to Bet"/>
+              </columns>
+            </TableView>
+          </children>
+        </VBox>
+        <VBox alignment="center" minHeight="0.0" minWidth="0.0" prefHeight="229.0" prefWidth="998.0">
+          <children>
+            <HBox prefHeight="23.0" prefWidth="998.0">
+              <children>
+                <Button mnemonicParsing="false" onAction="#addRowAction" text="Add New Row" />
+                <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Över 1.5 om score &gt; 5 och under 4.5 om score &lt; 3"
+                  wrappingWidth="303.486328125" />
+              </children>
+            </HBox>
+
+            <TableView fx:id="activeBettingTable" layoutY="25.0" prefHeight="189.0" prefWidth="998.0" />
+          </children>
+        </VBox>
+      </items>
+    </SplitPane>
+  </children>
 </AnchorPane>

+ 73 - 29
OddsJavaFx/src/fxml/PastResults.fxml

@@ -4,8 +4,11 @@
 <?import javafx.scene.control.Button?>
 <?import javafx.scene.control.ComboBox?>
 <?import javafx.scene.control.DatePicker?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.control.SplitPane?>
 <?import javafx.scene.control.TableColumn?>
 <?import javafx.scene.control.TableView?>
+<?import javafx.scene.control.TextArea?>
 <?import javafx.scene.layout.AnchorPane?>
 <?import javafx.scene.layout.ColumnConstraints?>
 <?import javafx.scene.layout.FlowPane?>
@@ -14,9 +17,9 @@
 <?import javafx.scene.layout.VBox?>
 <?import javafx.scene.text.Text?>
 
-<AnchorPane fx:id="basePane" prefHeight="414.0" prefWidth="736.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.PastResultsController">
+<AnchorPane fx:id="basePane" prefHeight="600.0" prefWidth="736.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.PastResultsController">
    <children>
-      <VBox prefHeight="414.0" prefWidth="736.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+      <VBox prefHeight="600.0" prefWidth="736.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
          <children>
           <AnchorPane>
                <children>
@@ -27,11 +30,12 @@
                         <ComboBox id="LeagueComboBox" fx:id="leagueSelector" disable="true" onAction="#leagueSelected" prefHeight="25.0" prefWidth="200.0" promptText="League" />
                         <Button mnemonicParsing="false" onAction="#updateStatsTable" text="Update Statistics" />
                         <Button mnemonicParsing="false" onAction="#updateStandingsTable" text="Update standings table" />
+                        <Button mnemonicParsing="false" onAction="#getAllMatchesAtDate" text="Get all matches for date" />
                      </children>
                   </FlowPane>
                </children>
             </AnchorPane>
-          <AnchorPane>
+          <AnchorPane VBox.vgrow="ALWAYS">
                <children>
                	   <TableView fx:id="matchTable" prefHeight="546.0" prefWidth="893.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
 				     <columns>
@@ -54,37 +58,77 @@
 				       <TableColumn fx:id="avgAwayConcededSeason" prefWidth="75.0" text="AwayConcededSeason" />
 				       <TableColumn fx:id="sumScoringColumn" prefWidth="75.0" text="Sum scoring" />
 				       <TableColumn fx:id="positionAdjustmentColumn" prefWidth="75.0" text="Position Adjustments" />
-				       <TableColumn fx:id="awayWinColumn" prefWidth="75.0" text="Away win" />
+				       <TableColumn fx:id="newScoringTestColumn" prefWidth="75.0" text="New scoring test" />
+				       <TableColumn fx:id="addToBetsButtonColumn" prefWidth="75.0" text="Add bet" />
 				     </columns>
 				   </TableView>
                </children>
             </AnchorPane>
-            <AnchorPane minHeight="100.0" minWidth="200.0" prefHeight="200.0" prefWidth="200.0">
+            <AnchorPane minHeight="200.0" minWidth="200.0">
                <children>
-                  <GridPane prefHeight="100.0" prefWidth="736.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
-                    <columnConstraints>
-                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
-                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
-                    </columnConstraints>
-                    <rowConstraints>
-                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
-                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
-                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
-                    </rowConstraints>
-                     <children>
-                        <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Past results homeTeam" />
-                        <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Past results awayTeam" GridPane.rowIndex="1" />
-                        <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Past meeting results" GridPane.rowIndex="2" />
-                        <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Past reverse meeting results" GridPane.rowIndex="3" />
-                        <Text fx:id="homeTeamPastResultsText" strokeType="OUTSIDE" strokeWidth="0.0" text="Placeholder homeTeam" GridPane.columnIndex="1" />
-                        <Text fx:id="awayTeamPastResultsText" strokeType="OUTSIDE" strokeWidth="0.0" text="Placeholder awayTeam" GridPane.columnIndex="1" GridPane.rowIndex="1" />
-                        <Text fx:id="previousMeetingsText" strokeType="OUTSIDE" strokeWidth="0.0" text="Placeholder meets" GridPane.columnIndex="1" GridPane.rowIndex="2" />
-                        <Text fx:id="previousReverseMeetingsText" strokeType="OUTSIDE" strokeWidth="0.0" text="Placeholder Reverse meets" GridPane.columnIndex="1" GridPane.rowIndex="3" />
-                     </children>
-                     <opaqueInsets>
-                        <Insets />
-                     </opaqueInsets>
-                  </GridPane>
+                  <SplitPane dividerPositions="0.5" prefHeight="100.0" prefWidth="736.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                     <items>
+                        <GridPane prefHeight="100.0" prefWidth="736.0">
+                          <columnConstraints>
+                            <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
+                            <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
+                          </columnConstraints>
+                          <rowConstraints>
+                            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
+                            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
+                            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
+                              <RowConstraints />
+                          </rowConstraints>
+                           <children>
+                              <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Past results homeTeam" />
+                              <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Past results awayTeam" GridPane.rowIndex="1" />
+                              <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Past meeting results" GridPane.rowIndex="2" />
+                              <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Past reverse meeting results" GridPane.rowIndex="3" />
+                              <Text fx:id="homeTeamPastResultsText" strokeType="OUTSIDE" strokeWidth="0.0" text="Placeholder homeTeam" GridPane.columnIndex="1" />
+                              <Text fx:id="awayTeamPastResultsText" strokeType="OUTSIDE" strokeWidth="0.0" text="Placeholder awayTeam" GridPane.columnIndex="1" GridPane.rowIndex="1" />
+                              <Text fx:id="previousMeetingsText" strokeType="OUTSIDE" strokeWidth="0.0" text="Placeholder meets" GridPane.columnIndex="1" GridPane.rowIndex="2" />
+                              <Text fx:id="previousReverseMeetingsText" strokeType="OUTSIDE" strokeWidth="0.0" text="Placeholder Reverse meets" GridPane.columnIndex="1" GridPane.rowIndex="3" />
+                           </children>
+                           <opaqueInsets>
+                              <Insets />
+                           </opaqueInsets>
+                        </GridPane>
+                        <SplitPane dividerPositions="0.75" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
+                          <items>
+                            <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
+                                 <children>
+                                    <GridPane prefHeight="71.0" prefWidth="364.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                                      <columnConstraints>
+                                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
+                                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
+                                      </columnConstraints>
+                                      <rowConstraints>
+                                        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
+                                        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
+                                        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
+                                          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
+                                      </rowConstraints>
+                                       <children>
+                                          <Label text="Number of games" />
+                                          <Label fx:id="NumberOfGamesText" text="0" GridPane.columnIndex="1" />
+                                          <Label text="Systems" GridPane.rowIndex="1" GridPane.rowSpan="2" />
+                                          <TextArea fx:id="SystemsText" text="" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.rowSpan="2" />
+                                          <Label prefHeight="17.0" prefWidth="36.0" text="Result" GridPane.rowIndex="3" />
+                                          <Label fx:id="ReslutsText" text="" GridPane.columnIndex="1" GridPane.rowIndex="3" />
+                                       </children>
+                                    </GridPane>
+                                 </children>
+                              </AnchorPane>
+                            <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
+                                 <children>
+                                    <Button mnemonicParsing="false" onAction="#CheckBetSlip" text="Rätta" />
+                                    <Button layoutX="312.0" layoutY="-2.0" mnemonicParsing="false" onAction="#ClearBetSlip" text="Rensa" />
+                                 </children>
+                              </AnchorPane>
+                          </items>
+                        </SplitPane>
+                     </items>
+                  </SplitPane>
                </children>
             </AnchorPane>
          </children>

+ 16 - 24
OddsJavaFx/src/tests/LastResultsTest.java

@@ -38,10 +38,8 @@ public class LastResultsTest extends TestClass {
 				bank = startingBank;
 				season = soccerMatch.getSeason();
 			}
-			final TeamResults homeTeamResults = GuiMysql.getInstance()
-					.getTeamResults(soccerMatch.getHomeTeam().getTeamId(), lookBack, true);
-			final TeamResults awayTeamResults = GuiMysql.getInstance()
-					.getTeamResults(soccerMatch.getAwayTeam().getTeamId(), lookBack, false);
+			final TeamResults homeTeamResults = GuiMysql.getInstance().getTeamResults(soccerMatch.getHomeTeam().getTeamId(), lookBack, true);
+			final TeamResults awayTeamResults = GuiMysql.getInstance().getTeamResults(soccerMatch.getAwayTeam().getTeamId(), lookBack, false);
 
 			final float homeWinPercent = (homeTeamResults.getWins() + awayTeamResults.getLosses())
 					/ Float.valueOf(homeTeamResults.getCount() + awayTeamResults.getCount()) * 100;
@@ -94,8 +92,8 @@ public class LastResultsTest extends TestClass {
 		}
 
 		System.out.println("season " + season + " ended with " + bank);
-		System.out.println("Match count " + matches.size() + " leagueId " + leagueId + " countryId " + countryId
-				+ " bet on " + betOnGameCount + "(" + betOnGameCount / (float) totalMatchCount + ")");
+		System.out.println("Match count " + matches.size() + " leagueId " + leagueId + " countryId " + countryId + " bet on " + betOnGameCount + "("
+				+ betOnGameCount / (float) totalMatchCount + ")");
 	}
 
 	public void calcBestResults(int sportId, Integer countryId, Integer leagueId) {
@@ -108,7 +106,7 @@ public class LastResultsTest extends TestClass {
 		float bestBankResult = 1000f;
 
 		final List<SoccerMatch> matches = GuiMysql.getInstance().getMatches(sportId, countryId, leagueId,
-				LocalDate.now().atStartOfDay().format(DateTimeFormatter.ISO_DATE), "ASC", false);
+				LocalDate.now().atStartOfDay().format(DateTimeFormatter.ISO_DATE), "ASC", false, false);
 
 		final LocalDateTime currentDate = matches.get(0).getGameDate();
 		LocalDate localDate = currentDate.toLocalDate();
@@ -125,12 +123,10 @@ public class LastResultsTest extends TestClass {
 						continue;
 					}
 
-					final TeamResults homeTeamResults = GuiMysql.getInstance().getTeamResultsTest(
-							soccerMatch.getHomeTeam().getTeamId(), lookBack, true,
-							soccerMatch.getGameDate().format(DateTimeFormatter.ISO_DATE));
-					final TeamResults awayTeamResults = GuiMysql.getInstance().getTeamResultsTest(
-							soccerMatch.getAwayTeam().getTeamId(), lookBack, false,
-							soccerMatch.getGameDate().format(DateTimeFormatter.ISO_DATE));
+					final TeamResults homeTeamResults = GuiMysql.getInstance().getTeamResultsTest(soccerMatch.getHomeTeam().getTeamId(), lookBack,
+							true, soccerMatch.getGameDate().format(DateTimeFormatter.ISO_DATE));
+					final TeamResults awayTeamResults = GuiMysql.getInstance().getTeamResultsTest(soccerMatch.getAwayTeam().getTeamId(), lookBack,
+							false, soccerMatch.getGameDate().format(DateTimeFormatter.ISO_DATE));
 
 					final float homeWinPercent = (homeTeamResults.getWins() + awayTeamResults.getLosses())
 							/ Float.valueOf(homeTeamResults.getCount() + awayTeamResults.getCount()) * 100;
@@ -163,26 +159,22 @@ public class LastResultsTest extends TestClass {
 				}
 
 				if (bestBankResult < bank) {
-					System.out.println("New best bank " + bank + " with lookback " + lookBack + " and betMargin "
-							+ betMargin + " Bet on " + betOnGameCount + " of " + matches.size() + "("
-							+ betOnGameCount / (float) matches.size() + ") wins " + wins + "("
-							+ wins / Float.valueOf(betOnGameCount) + ")" + " Win / game "
-							+ (bank - startingBank) / Float.valueOf(wins) + " kr");
+					System.out.println("New best bank " + bank + " with lookback " + lookBack + " and betMargin " + betMargin + " Bet on "
+							+ betOnGameCount + " of " + matches.size() + "(" + betOnGameCount / (float) matches.size() + ") wins " + wins + "("
+							+ wins / Float.valueOf(betOnGameCount) + ")" + " Win / game " + (bank - startingBank) / Float.valueOf(wins) + " kr");
 					bestBetMargin = betMargin;
 					bestLookBack = lookBack;
 					bestBankResult = bank;
 				} else {
-					System.out.println("NOT BEST bank " + bank + " with lookback " + lookBack + " and betMargin "
-							+ betMargin + " Bet on " + betOnGameCount + " of " + matches.size() + "("
-							+ betOnGameCount / (float) matches.size() + ") wins " + wins + "("
-							+ wins / Float.valueOf(betOnGameCount) + ")" + " Win / game "
-							+ (bank - startingBank) / Float.valueOf(wins) + " kr");
+					System.out.println("NOT BEST bank " + bank + " with lookback " + lookBack + " and betMargin " + betMargin + " Bet on "
+							+ betOnGameCount + " of " + matches.size() + "(" + betOnGameCount / (float) matches.size() + ") wins " + wins + "("
+							+ wins / Float.valueOf(betOnGameCount) + ")" + " Win / game " + (bank - startingBank) / Float.valueOf(wins) + " kr");
 				}
 			}
 		}
 	}
 
 	public List<SoccerMatch> getMatches(int leagueId) {
-		return GuiMysql.getInstance().getMatches(sportId, countryId, leagueId, date, "ASC", false);
+		return GuiMysql.getInstance().getMatches(sportId, countryId, leagueId, date, "ASC", false, false);
 	}
 }