|
|
@@ -81,10 +81,10 @@ class WebDbConnection {
|
|
|
$league = $this->getLeagueInfo($leagueId);
|
|
|
|
|
|
echo "</br></br> League </br>";
|
|
|
- var_dump($league);
|
|
|
+ var_dump($league[0]);
|
|
|
|
|
|
- $lookback = $league['lookback'];
|
|
|
- $betMargin = $league['betMargin'];
|
|
|
+ $lookback = $league[0]['lookback'];
|
|
|
+ $betMargin = $league[0]['betMargin'];
|
|
|
|
|
|
$homeTeamResults = $this->getTeamResults($match['homeTeam'], $lookback, true);
|
|
|
$awayTeamResults = $this->getTeamResults($match['awayTeam'], $lookback, false);
|
|
|
@@ -126,19 +126,19 @@ class WebDbConnection {
|
|
|
public function getTeamResults($teamId, $numResults, $isHomeTeam) {
|
|
|
$sql = "";
|
|
|
if ($isHomeTeam) {
|
|
|
- $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 homeTeam = " . $teamId . " AND " +
|
|
|
+ $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 homeTeam = " . $teamId . " AND " .
|
|
|
"HomeScore >= 0 AND awayScore >= 0 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 " +
|
|
|
+ $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";
|
|
|
}
|
|
|
|
|
|
- return $mysql->getSqlAsArray($sql);
|
|
|
+ return $this->getSqlAsArray($sql);
|
|
|
}
|
|
|
}
|