|
|
@@ -86,8 +86,8 @@ class WebDbConnection {
|
|
|
$lookback = $league[0]['lookback'];
|
|
|
$betMargin = $league[0]['betMargin'];
|
|
|
|
|
|
- $homeTeamResults = $this->getTeamResults($match['homeTeam'], $lookback, true);
|
|
|
- $awayTeamResults = $this->getTeamResults($match['awayTeam'], $lookback, false);
|
|
|
+ $homeTeamResults = $this->getTeamResults($match['homeTeam'], $lookback, true)[0];
|
|
|
+ $awayTeamResults = $this->getTeamResults($match['awayTeam'], $lookback, false)[0];
|
|
|
|
|
|
echo "</br></br> HomeTeam </br>";
|
|
|
var_dump($homeTeamResults);
|
|
|
@@ -97,16 +97,16 @@ class WebDbConnection {
|
|
|
$homeTeamCount = $homeTeamResults['wins'] + $homeTeamResults['draws'] + $homeTeamResults['lost'];
|
|
|
$awayTeamCount = $awayTeamResults['wins'] + $awayTeamResults['draws'] + $awayTeamResults['lost'];
|
|
|
|
|
|
- $homeWinPercent = (($homeTeamResults['wins'] + $awayTeamResults['lost']) / $homeTeamCount + $awayTeamCount) * 100;
|
|
|
- $drawPercent = (($homeTeamResults['draws'] + $awayTeamResults['draws']) / $homeTeamCount + $awayTeamCount) * 100;
|
|
|
- $awayWinPercent = (($awayTeamResults['wins'] + $homeTeamResults['lost']) / $homeTeamCount + $awayTeamCount) * 100;
|
|
|
+ $homeWinPercent = round((($homeTeamResults['wins'] + $awayTeamResults['lost']) / ($homeTeamCount + $awayTeamCount)) * 100,2);
|
|
|
+ $drawPercent = round((($homeTeamResults['draws'] + $awayTeamResults['draws']) / ($homeTeamCount + $awayTeamCount)) * 100, 2);
|
|
|
+ $awayWinPercent = round((($awayTeamResults['wins'] + $homeTeamResults['lost']) / ($homeTeamCount + $awayTeamCount)) * 100, 2);
|
|
|
|
|
|
$match['homeWinPercent'] = $homeWinPercent;
|
|
|
$match['drawPercent'] = $drawPercent;
|
|
|
$match['awayWinPercent'] = $awayWinPercent;
|
|
|
|
|
|
|
|
|
- echo "</br></br> matchDoneEdit added percentages $homeWinPercent, $drawPercent, $awayWinPercent</br>";
|
|
|
+ echo "</br></br> matchDoneEdit added percentages " . $homeWinPercent . ", $drawPercent, $awayWinPercent </br>";
|
|
|
var_dump($match);
|
|
|
die();
|
|
|
/*
|
|
|
@@ -143,13 +143,13 @@ class WebDbConnection {
|
|
|
"count(case when awayScore > homeScore then 1 end) lost, " .
|
|
|
"count(case when homeScore = awayScore then 1 end) draws " .
|
|
|
"FROM (SELECT * FROM SoccerResults WHERE homeTeam = " . $teamId . " AND " .
|
|
|
- "HomeScore >= 0 AND awayScore >= 0 ORDER BY gameDate DESC LIMIT " . $numResults . ") as t";
|
|
|
+ "HomeScore >= 0 AND awayScore >= 0 AND DATE(gameDate) < DATE(NOW()) ORDER BY gameDate DESC LIMIT " . $numResults . ") as t";
|
|
|
} else {
|
|
|
$sql = "SELECT count(case when homeScore < awayScore then 1 end) wins, " .
|
|
|
"count(case when awayScore < homeScore then 1 end) lost, " .
|
|
|
"count(case when homeScore = awayScore then 1 end) draws " .
|
|
|
"FROM (SELECT * FROM SoccerResults WHERE awayTeam = " . $teamId . " AND " .
|
|
|
- "HomeScore >= 0 AND awayScore >= 0 ORDER BY gameDate DESC LIMIT " . $numResults . ") as t";
|
|
|
+ "HomeScore >= 0 AND awayScore >= 0 AND DATE(gameDate) < DATE(NOW()) ORDER BY gameDate DESC LIMIT " . $numResults . ") as t";
|
|
|
}
|
|
|
|
|
|
return $this->getSqlAsArray($sql);
|