Browse Source

Uppdaterat till ResultDTO i addResult

Axel Nordh 3 năm trước cách đây
mục cha
commit
d447c13a8c

+ 37 - 33
Odds/src/mysql/Mysql.java

@@ -12,6 +12,7 @@ import java.time.format.DateTimeFormatter;
 import org.eclipse.jetty.util.log.Log;
 import org.eclipse.jetty.util.log.Log;
 
 
 import object.CurrentParsing;
 import object.CurrentParsing;
+import object.ResultDTO;
 
 
 public class Mysql {
 public class Mysql {
 
 
@@ -172,40 +173,43 @@ public class Mysql {
 		return id;
 		return id;
 	}
 	}
 
 
-	public void addResult(String tableName, LocalDateTime gameDate, String homeTeam, String awayTeam, int homeScore,
-			int awayScore, boolean overtime, float odds1, float oddsX, float odds2, int countryId, String season,
-			int leagueId, int sportId) throws SQLException {
+	public void addResult(ResultDTO result) throws SQLException {
+//		String tableName, LocalDateTime gameDate, String homeTeam, String awayTeam, int homeScore,
+//			int awayScore, boolean overtime, float odds1, float oddsX, float odds2, int countryId, String season,
+//			int leagueId, int sportId) throws SQLException {
 
 
-		final int homeTeamId = getOrInsertTeam(homeTeam, countryId, leagueId, sportId);
-		final int awayTeamId = getOrInsertTeam(awayTeam, countryId, leagueId, sportId);
+		final int homeTeamId = getOrInsertTeam(result.getHomeTeam(), result.getCountryId(), result.getLeagueId(),
+				result.getSportId());
+		final int awayTeamId = getOrInsertTeam(result.getAwayTeam(), result.getCountryId(), result.getLeagueId(),
+				result.getSportId());
 
 
 		final String selectSql = "SELECT id FROM SoccerResults WHERE homeTeamId = ? AND awayTeamId = ? AND DATE(gameDate) = ?";
 		final String selectSql = "SELECT id FROM SoccerResults WHERE homeTeamId = ? AND awayTeamId = ? AND DATE(gameDate) = ?";
 		final ResultSet rs;
 		final ResultSet rs;
-		final String date = gameDate.format(DateTimeFormatter.ISO_DATE);
+		int gameId = -1;
+		final String date = result.getGameDate().format(DateTimeFormatter.ISO_DATE);
 		try (PreparedStatement stat = conn.prepareStatement(selectSql)) {
 		try (PreparedStatement stat = conn.prepareStatement(selectSql)) {
 			stat.setInt(1, homeTeamId);
 			stat.setInt(1, homeTeamId);
 			stat.setInt(2, awayTeamId);
 			stat.setInt(2, awayTeamId);
 			stat.setString(3, date);
 			stat.setString(3, date);
 
 
 			rs = stat.executeQuery();
 			rs = stat.executeQuery();
+			while (rs.next()) {
+				gameId = rs.getInt("id");
+			}
 		}
 		}
 
 
-		int gameId = -1;
-		while (rs.next()) {
-			gameId = rs.getInt("id");
-		}
 		if (gameId != -1) {
 		if (gameId != -1) {
-			final String sql = "UPDATE " + tableName
+			final String sql = "UPDATE " + result.getTableName()
 					+ " SET homeScore = ?, awayScore = ?, overtime = ?, odds1 = ?, oddsX = ?, odds2 = ? "
 					+ " SET homeScore = ?, awayScore = ?, overtime = ?, odds1 = ?, oddsX = ?, odds2 = ? "
 					+ "WHERE homeTeamId = ? AND awayTeamId = ? AND DATE(gameDate) = ?";
 					+ "WHERE homeTeamId = ? AND awayTeamId = ? AND DATE(gameDate) = ?";
 
 
 			try (PreparedStatement stat = conn.prepareStatement(sql)) {
 			try (PreparedStatement stat = conn.prepareStatement(sql)) {
-				stat.setInt(1, homeScore);
-				stat.setInt(2, awayScore);
-				stat.setBoolean(3, overtime);
-				stat.setFloat(4, odds1);
-				stat.setFloat(5, oddsX);
-				stat.setFloat(6, odds2);
+				stat.setInt(1, result.getHomeScore());
+				stat.setInt(2, result.getAwayScore());
+				stat.setBoolean(3, result.isOvertime());
+				stat.setFloat(4, result.getOdds1());
+				stat.setFloat(5, result.getOddsX());
+				stat.setFloat(6, result.getOdds2());
 				stat.setInt(7, homeTeamId);
 				stat.setInt(7, homeTeamId);
 				stat.setInt(8, awayTeamId);
 				stat.setInt(8, awayTeamId);
 				stat.setString(9, date);
 				stat.setString(9, date);
@@ -214,27 +218,27 @@ public class Mysql {
 			}
 			}
 
 
 		} else {
 		} else {
-			final String sql = "INSERT INTO " + tableName
+			final String sql = "INSERT INTO " + result.getTableName()
 					+ " (homeTeamId, awayTeamId, homeScore, awayScore, overtime, odds1, oddsX, odds2, countryId, gameDate, season, leagueId) "
 					+ " (homeTeamId, awayTeamId, homeScore, awayScore, overtime, odds1, oddsX, odds2, countryId, gameDate, season, leagueId) "
 					+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE homeScore = ?, awayScore = ?, odds1 = ?, oddsX = ?, odds2 = ?";
 					+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE homeScore = ?, awayScore = ?, odds1 = ?, oddsX = ?, odds2 = ?";
 			try (PreparedStatement stat = conn.prepareStatement(sql)) {
 			try (PreparedStatement stat = conn.prepareStatement(sql)) {
 				stat.setInt(1, homeTeamId);
 				stat.setInt(1, homeTeamId);
 				stat.setInt(2, awayTeamId);
 				stat.setInt(2, awayTeamId);
-				stat.setInt(3, homeScore);
-				stat.setInt(4, awayScore);
-				stat.setBoolean(5, overtime);
-				stat.setFloat(6, odds1);
-				stat.setFloat(7, oddsX);
-				stat.setFloat(8, odds2);
-				stat.setInt(9, countryId);
-				stat.setString(10, gameDate.toString());
-				stat.setString(11, season);
-				stat.setInt(12, leagueId);
-				stat.setInt(13, homeScore);
-				stat.setInt(14, awayScore);
-				stat.setFloat(15, odds1);
-				stat.setFloat(16, oddsX);
-				stat.setFloat(17, odds2);
+				stat.setInt(3, result.getHomeScore());
+				stat.setInt(4, result.getAwayScore());
+				stat.setBoolean(5, result.isOvertime());
+				stat.setFloat(6, result.getOdds1());
+				stat.setFloat(7, result.getOddsX());
+				stat.setFloat(8, result.getOdds2());
+				stat.setInt(9, result.getCountryId());
+				stat.setString(10, result.getGameDate().toString());
+				stat.setString(11, result.getSeason());
+				stat.setInt(12, result.getLeagueId());
+				stat.setInt(13, result.getHomeScore());
+				stat.setInt(14, result.getAwayScore());
+				stat.setFloat(15, result.getOdds1());
+				stat.setFloat(16, result.getOddsX());
+				stat.setFloat(17, result.getOdds2());
 
 
 				stat.execute();
 				stat.execute();
 			}
 			}

+ 154 - 0
Odds/src/object/ResultDTO.java

@@ -0,0 +1,154 @@
+package object;
+
+import java.time.LocalDateTime;
+
+public class ResultDTO {
+
+	String tableName;
+	LocalDateTime gameDate;
+	String homeTeam;
+	String awayTeam;
+	int homeScore;
+	int awayScore;
+	boolean overtime;
+	float odds1;
+	float oddsX;
+	float odds2;
+	int countryId;
+	String season;
+	int leagueId;
+	int sportId;
+
+	public ResultDTO(String tableName, LocalDateTime gameDate, String homeTeam, String awayTeam, int homeScore,
+			int awayScore, boolean overtime, float odds1, float oddsX, float odds2, int countryId, String season,
+			int leagueId, int sportId) {
+		super();
+		this.tableName = tableName;
+		this.gameDate = gameDate;
+		this.homeTeam = homeTeam;
+		this.awayTeam = awayTeam;
+		this.homeScore = homeScore;
+		this.awayScore = awayScore;
+		this.overtime = overtime;
+		this.odds1 = odds1;
+		this.oddsX = oddsX;
+		this.odds2 = odds2;
+		this.countryId = countryId;
+		this.season = season;
+		this.leagueId = leagueId;
+		this.sportId = sportId;
+	}
+
+	public String getTableName() {
+		return tableName;
+	}
+
+	public void setTableName(String tableName) {
+		this.tableName = tableName;
+	}
+
+	public LocalDateTime getGameDate() {
+		return gameDate;
+	}
+
+	public void setGameDate(LocalDateTime gameDate) {
+		this.gameDate = gameDate;
+	}
+
+	public String getHomeTeam() {
+		return homeTeam;
+	}
+
+	public void setHomeTeam(String homeTeam) {
+		this.homeTeam = homeTeam;
+	}
+
+	public String getAwayTeam() {
+		return awayTeam;
+	}
+
+	public void setAwayTeam(String awayTeam) {
+		this.awayTeam = awayTeam;
+	}
+
+	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 boolean isOvertime() {
+		return overtime;
+	}
+
+	public void setOvertime(boolean overtime) {
+		this.overtime = overtime;
+	}
+
+	public float getOdds1() {
+		return odds1;
+	}
+
+	public void setOdds1(float odds1) {
+		this.odds1 = odds1;
+	}
+
+	public float getOddsX() {
+		return oddsX;
+	}
+
+	public void setOddsX(float oddsX) {
+		this.oddsX = oddsX;
+	}
+
+	public float getOdds2() {
+		return odds2;
+	}
+
+	public void setOdds2(float odds2) {
+		this.odds2 = odds2;
+	}
+
+	public int getCountryId() {
+		return countryId;
+	}
+
+	public void setCountryId(int countryId) {
+		this.countryId = countryId;
+	}
+
+	public String getSeason() {
+		return season;
+	}
+
+	public void setSeason(String season) {
+		this.season = season;
+	}
+
+	public int getLeagueId() {
+		return leagueId;
+	}
+
+	public void setLeagueId(int leagueId) {
+		this.leagueId = leagueId;
+	}
+
+	public int getSportId() {
+		return sportId;
+	}
+
+	public void setSportId(int sportId) {
+		this.sportId = sportId;
+	}
+
+}

+ 5 - 4
Odds/src/parser/OddsPortal.java

@@ -24,6 +24,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
 import com.google.common.base.Strings;
 import com.google.common.base.Strings;
 
 
 import mysql.Mysql;
 import mysql.Mysql;
+import object.ResultDTO;
 
 
 public class OddsPortal implements ParserJoinedFunctions {
 public class OddsPortal implements ParserJoinedFunctions {
 
 
@@ -171,8 +172,8 @@ public class OddsPortal implements ParserJoinedFunctions {
 
 
 					final LocalDateTime dt = baseDate.withHour(Integer.valueOf(time[0]))
 					final LocalDateTime dt = baseDate.withHour(Integer.valueOf(time[0]))
 							.withMinute(Integer.valueOf(time[1])).withSecond(0).withNano(0);
 							.withMinute(Integer.valueOf(time[1])).withSecond(0).withNano(0);
-					mysql.addResult("SoccerResults", dt, teams[0].trim(), teams[1].trim(), homeScore, awayScore,
-							overtime, odds1, oddsX, odds2, countrysId, season, leaguesId, sportsId);
+					mysql.addResult(new ResultDTO("SoccerResults", dt, teams[0].trim(), teams[1].trim(), homeScore,
+							awayScore, overtime, odds1, oddsX, odds2, countrysId, season, leaguesId, sportsId));
 				}
 				}
 			}
 			}
 		} catch (FailingHttpStatusCodeException | IOException | SQLException e) {
 		} catch (FailingHttpStatusCodeException | IOException | SQLException e) {
@@ -322,8 +323,8 @@ public class OddsPortal implements ParserJoinedFunctions {
 
 
 				if (gameDate != null && homeTeam != null && awayTeam != null && odds1 != 0 && oddsX != 0 && odds2 != 0
 				if (gameDate != null && homeTeam != null && awayTeam != null && odds1 != 0 && oddsX != 0 && odds2 != 0
 						&& !Strings.isNullOrEmpty(season)) { // All set.. update sql result table
 						&& !Strings.isNullOrEmpty(season)) { // All set.. update sql result table
-					Mysql.getInstance().addResult("SoccerResults", gameDate, homeTeam, awayTeam, homeScore, awayScore,
-							overtime, odds1, oddsX, odds2, countryId, season, leagueId, sportId);
+					Mysql.getInstance().addResult(new ResultDTO("SoccerResults", gameDate, homeTeam, awayTeam,
+							homeScore, awayScore, overtime, odds1, oddsX, odds2, countryId, season, leagueId, sportId));
 				}
 				}
 
 
 			} else if (tr.getAttribute(CLASS).contains("center nob-border")) { // Datum rader
 			} else if (tr.getAttribute(CLASS).contains("center nob-border")) { // Datum rader

+ 45 - 31
OddsJavaFx/src/parser/OddsPortal.java

@@ -22,6 +22,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
 import com.google.common.base.Strings;
 import com.google.common.base.Strings;
 
 
 import mysql.Mysql;
 import mysql.Mysql;
+import object.ResultDTO;
 
 
 public class OddsPortal implements ParserJoinedFunctions {
 public class OddsPortal implements ParserJoinedFunctions {
 
 
@@ -32,10 +33,11 @@ public class OddsPortal implements ParserJoinedFunctions {
 	private int leagueId;
 	private int leagueId;
 	private LocalDateTime gameDate;
 	private LocalDateTime gameDate;
 
 
-	// https://stackoverflow.com/questions/14439991/skip-particular-javascript-execution-in-html-unit Skip url
+	// https://stackoverflow.com/questions/14439991/skip-particular-javascript-execution-in-html-unit
+	// Skip url
 	public void getMatchesByDate(String date) {
 	public void getMatchesByDate(String date) {
 		final String soccerUrl = "https://oddsportal.com/matches/soccer/" + date;
 		final String soccerUrl = "https://oddsportal.com/matches/soccer/" + date;
-		//		final String hockeyUrl = "https://oddsportal.com/matches/hockey/" + date;
+		// final String hockeyUrl = "https://oddsportal.com/matches/hockey/" + date;
 
 
 		final WebClient webClient = new WebClient();
 		final WebClient webClient = new WebClient();
 		webClient.getOptions().setUseInsecureSSL(true);
 		webClient.getOptions().setUseInsecureSSL(true);
@@ -89,7 +91,7 @@ public class OddsPortal implements ParserJoinedFunctions {
 								abandon = true;
 								abandon = true;
 								break;
 								break;
 							}
 							}
-							//Score
+							// Score
 							if (tc.getAttribute("class").contains("table-score")) {
 							if (tc.getAttribute("class").contains("table-score")) {
 								final String[] scoreValue = tc.getTextContent().split(":");
 								final String[] scoreValue = tc.getTextContent().split(":");
 								homeScore = Integer.valueOf(scoreValue[0]);
 								homeScore = Integer.valueOf(scoreValue[0]);
@@ -102,17 +104,17 @@ public class OddsPortal implements ParserJoinedFunctions {
 								if (tc.getTextContent().matches("[+-][0-9][0-9][0-9]")) {
 								if (tc.getTextContent().matches("[+-][0-9][0-9][0-9]")) {
 									if (odds1 == 0F) {
 									if (odds1 == 0F) {
 										odds1 = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
 										odds1 = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
-									} else if (oddsX == 0F ) {
+									} else if (oddsX == 0F) {
 										oddsX = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
 										oddsX = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
-									} else if (odds2 == 0F ) {
+									} else if (odds2 == 0F) {
 										odds2 = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
 										odds2 = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
 									}
 									}
 								} else if (tc.getTextContent().matches("[0-9].[0-9]+")) {
 								} else if (tc.getTextContent().matches("[0-9].[0-9]+")) {
 									if (odds1 == 0F) {
 									if (odds1 == 0F) {
 										odds1 = Float.valueOf(tc.getTextContent());
 										odds1 = Float.valueOf(tc.getTextContent());
-									} else if (oddsX == 0F ) {
+									} else if (oddsX == 0F) {
 										oddsX = Float.valueOf(tc.getTextContent());
 										oddsX = Float.valueOf(tc.getTextContent());
-									} else if (odds2 == 0F ) {
+									} else if (odds2 == 0F) {
 										odds2 = Float.valueOf(tc.getTextContent());
 										odds2 = Float.valueOf(tc.getTextContent());
 									}
 									}
 								}
 								}
@@ -120,9 +122,14 @@ public class OddsPortal implements ParserJoinedFunctions {
 
 
 						}
 						}
 					} catch (final NumberFormatException e) {
 					} catch (final NumberFormatException e) {
-						System.out.println("Failed to get the match between " + teams[0].trim() + " and " + teams[1].trim() + " at " +
-								baseDate.withHour(Integer.valueOf(time[0])).withMinute(Integer.valueOf(time[1])) +
-								" odds1: " + odds1 + " oddsX: " + oddsX + " odds2: " + odds2 + " homeScore " + homeScore + " awayScore " + awayScore + " overtime: " + (overtime?"true":"false"));
+						System.out
+								.println("Failed to get the match between " + teams[0].trim() + " and "
+										+ teams[1].trim() + " at "
+										+ baseDate.withHour(Integer.valueOf(time[0]))
+												.withMinute(Integer.valueOf(time[1]))
+										+ " odds1: " + odds1 + " oddsX: " + oddsX + " odds2: " + odds2 + " homeScore "
+										+ homeScore + " awayScore " + awayScore + " overtime: "
+										+ (overtime ? "true" : "false"));
 						continue;
 						continue;
 					}
 					}
 
 
@@ -140,8 +147,10 @@ public class OddsPortal implements ParserJoinedFunctions {
 						season = String.valueOf(LocalDateTime.now().getYear());
 						season = String.valueOf(LocalDateTime.now().getYear());
 					}
 					}
 
 
-					final LocalDateTime dt = baseDate.withHour(Integer.valueOf(time[0])).withMinute(Integer.valueOf(time[1])).withSecond(0).withNano(0);
-					mysql.addResult("SoccerResults", dt, teams[0].trim(), teams[1].trim(), homeScore, awayScore, overtime, odds1, oddsX, odds2, countryId, season, leagueId, sportId);
+					final LocalDateTime dt = baseDate.withHour(Integer.valueOf(time[0]))
+							.withMinute(Integer.valueOf(time[1])).withSecond(0).withNano(0);
+					mysql.addResult(new ResultDTO("SoccerResults", dt, teams[0].trim(), teams[1].trim(), homeScore,
+							awayScore, overtime, odds1, oddsX, odds2, countryId, season, leagueId, sportId));
 				}
 				}
 			}
 			}
 		} catch (FailingHttpStatusCodeException | IOException e) {
 		} catch (FailingHttpStatusCodeException | IOException e) {
@@ -182,11 +191,12 @@ public class OddsPortal implements ParserJoinedFunctions {
 			leagueId = mysql.getLeagueId(sportId, countryId, league);
 			leagueId = mysql.getLeagueId(sportId, countryId, league);
 			String season = "";
 			String season = "";
 
 
-			final HtmlPage leaguePage = webClient.getPage(url + "/" + sport + "/" + country + "/" + league + urlYearPart + resultsPage);
+			final HtmlPage leaguePage = webClient
+					.getPage(url + "/" + sport + "/" + country + "/" + league + urlYearPart + resultsPage);
 			final List<HtmlAnchor> yearFilter = leaguePage.getByXPath("//ul[contains(@class,'main-filter')]//a");
 			final List<HtmlAnchor> yearFilter = leaguePage.getByXPath("//ul[contains(@class,'main-filter')]//a");
 			for (final HtmlAnchor a : yearFilter) {
 			for (final HtmlAnchor a : yearFilter) {
 				System.out.println("Year filter: " + a.getHrefAttribute());
 				System.out.println("Year filter: " + a.getHrefAttribute());
-				final String active = ((HtmlSpan)a.getParentNode().getParentNode()).getAttribute("class");
+				final String active = ((HtmlSpan) a.getParentNode().getParentNode()).getAttribute("class");
 				if (active.contains("active") && !active.contains("inactive")) {
 				if (active.contains("active") && !active.contains("inactive")) {
 					season = a.getTextContent();
 					season = a.getTextContent();
 					year = season.replace('/', '-');
 					year = season.replace('/', '-');
@@ -200,7 +210,8 @@ public class OddsPortal implements ParserJoinedFunctions {
 			final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy", Locale.ENGLISH);
 			final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy", Locale.ENGLISH);
 			parseTournamentTable(sportId, countryId, leagueId, season, tournamentTable, gameDate, dateFormatter);
 			parseTournamentTable(sportId, countryId, leagueId, season, tournamentTable, gameDate, dateFormatter);
 			final HtmlDivision paginationLinksDiv = (HtmlDivision) tournamentTableDiv.getLastChild();
 			final HtmlDivision paginationLinksDiv = (HtmlDivision) tournamentTableDiv.getLastChild();
-			final List<HtmlAnchor> pagiantionLinks = paginationLinksDiv.getByXPath(".//a[contains(@href, 'page') and not(.//span[contains(@class, 'arrow')])]");
+			final List<HtmlAnchor> pagiantionLinks = paginationLinksDiv
+					.getByXPath(".//a[contains(@href, 'page') and not(.//span[contains(@class, 'arrow')])]");
 			for (final HtmlAnchor a : pagiantionLinks) {
 			for (final HtmlAnchor a : pagiantionLinks) {
 				System.out.println("Continuing with Pagination: " + a.getHrefAttribute());
 				System.out.println("Continuing with Pagination: " + a.getHrefAttribute());
 				// When done with start page click pagiantion
 				// When done with start page click pagiantion
@@ -211,7 +222,8 @@ public class OddsPortal implements ParserJoinedFunctions {
 
 
 					tournamentTableDiv = leaguePage.getHtmlElementById("tournamentTable");
 					tournamentTableDiv = leaguePage.getHtmlElementById("tournamentTable");
 					tournamentTable = (HtmlTable) tournamentTableDiv.getFirstChild();
 					tournamentTable = (HtmlTable) tournamentTableDiv.getFirstChild();
-					parseTournamentTable(sportId, countryId, leagueId, season, tournamentTable, gameDate, dateFormatter);
+					parseTournamentTable(sportId, countryId, leagueId, season, tournamentTable, gameDate,
+							dateFormatter);
 					currentParsePage = parsePage;
 					currentParsePage = parsePage;
 				}
 				}
 				// process new tournament table content
 				// process new tournament table content
@@ -222,9 +234,8 @@ public class OddsPortal implements ParserJoinedFunctions {
 			sqle.printStackTrace();
 			sqle.printStackTrace();
 		} catch (final ClassCastException cce) {
 		} catch (final ClassCastException cce) {
 			System.out.println("No pagination table");
 			System.out.println("No pagination table");
-			//			cce.printStackTrace();
-		}
-		finally {
+			// cce.printStackTrace();
+		} finally {
 			Mysql.getInstance().setParsingForLeague(leagueId, sportId, countryId, gameDate, currentParsePage, year);
 			Mysql.getInstance().setParsingForLeague(leagueId, sportId, countryId, gameDate, currentParsePage, year);
 		}
 		}
 		webClient.close();
 		webClient.close();
@@ -257,10 +268,9 @@ public class OddsPortal implements ParserJoinedFunctions {
 				homeTeam = participantsValue[0].trim();
 				homeTeam = participantsValue[0].trim();
 				awayTeam = participantsValue[1].trim();
 				awayTeam = participantsValue[1].trim();
 
 
-
 				final List<HtmlTableCell> cells = tr.getCells();
 				final List<HtmlTableCell> cells = tr.getCells();
 				for (final HtmlTableCell tc : cells) {
 				for (final HtmlTableCell tc : cells) {
-					//Score
+					// Score
 					if (tc.getAttribute("class").contains("table-score")) {
 					if (tc.getAttribute("class").contains("table-score")) {
 						final String[] scoreValue = tc.getTextContent().split(":");
 						final String[] scoreValue = tc.getTextContent().split(":");
 						if (scoreValue[0].matches("\\D+")) {
 						if (scoreValue[0].matches("\\D+")) {
@@ -277,30 +287,34 @@ public class OddsPortal implements ParserJoinedFunctions {
 						if (tc.getTextContent().matches("[+-][0-9][0-9][0-9]")) {
 						if (tc.getTextContent().matches("[+-][0-9][0-9][0-9]")) {
 							if (odds1 == 0F) {
 							if (odds1 == 0F) {
 								odds1 = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
 								odds1 = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
-							} else if (oddsX == 0F ) {
+							} else if (oddsX == 0F) {
 								oddsX = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
 								oddsX = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
-							} else if (odds2 == 0F ) {
+							} else if (odds2 == 0F) {
 								odds2 = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
 								odds2 = convertAmericanOddsToDecimal(Integer.valueOf(tc.getTextContent()));
 							}
 							}
 						} else if (tc.getTextContent().matches("[0-9].[0-9]+")) {
 						} else if (tc.getTextContent().matches("[0-9].[0-9]+")) {
 							if (odds1 == 0F) {
 							if (odds1 == 0F) {
 								odds1 = Float.valueOf(tc.getTextContent());
 								odds1 = Float.valueOf(tc.getTextContent());
-							} else if (oddsX == 0F ) {
+							} else if (oddsX == 0F) {
 								oddsX = Float.valueOf(tc.getTextContent());
 								oddsX = Float.valueOf(tc.getTextContent());
-							} else if (odds2 == 0F ) {
+							} else if (odds2 == 0F) {
 								odds2 = Float.valueOf(tc.getTextContent());
 								odds2 = Float.valueOf(tc.getTextContent());
 							}
 							}
 						}
 						}
 					}
 					}
 				}
 				}
 
 
-				if (gameDate != null && homeTeam != null && awayTeam != null &&
-						odds1 != 0 && oddsX != 0 && odds2 != 0 && !Strings.isNullOrEmpty(season)) { // All set.. update sql result table
-					System.out.println("Adding game between " + homeTeam + " and " + awayTeam + " with score " + homeScore + "-" + awayScore);
-					Mysql.getInstance().addResult("SoccerResults", gameDate, homeTeam, awayTeam, homeScore, awayScore, overtime, odds1, oddsX, odds2, countryId, season, leagueId, sportId);
+				if (gameDate != null && homeTeam != null && awayTeam != null && odds1 != 0 && oddsX != 0 && odds2 != 0
+						&& !Strings.isNullOrEmpty(season)) { // All set.. update sql result table
+					System.out.println("Adding game between " + homeTeam + " and " + awayTeam + " with score "
+							+ homeScore + "-" + awayScore);
+					Mysql.getInstance().addResult(new ResultDTO("SoccerResults", gameDate, homeTeam, awayTeam,
+							homeScore, awayScore, overtime, odds1, oddsX, odds2, countryId, season, leagueId, sportId));
 				} else {
 				} else {
-					System.out.println(String.format("Not adding, missing somethind.. gameDate: %s, homeTeam %s, awayTeam %s, odds1 %s, oddsX %s, odds2 %s, "
-							+ "season %s", gameDate, homeTeam, awayTeam, odds1, oddsX, odds2, season));
+					System.out.println(String.format(
+							"Not adding, missing somethind.. gameDate: %s, homeTeam %s, awayTeam %s, odds1 %s, oddsX %s, odds2 %s, "
+									+ "season %s",
+							gameDate, homeTeam, awayTeam, odds1, oddsX, odds2, season));
 				}
 				}
 
 
 			} else if (tr.getAttribute("class").contains("center nob-border")) { // Datum rader
 			} else if (tr.getAttribute("class").contains("center nob-border")) { // Datum rader