Bladeren bron

wins and pennding for Day Stats

Axel Nordh 4 jaren geleden
bovenliggende
commit
9283c83ef1
2 gewijzigde bestanden met toevoegingen van 17 en 1 verwijderingen
  1. 5 1
      OddsJavaFx/src/web/index.php
  2. 12 0
      OddsJavaFx/src/web/webDbConnection.php

+ 5 - 1
OddsJavaFx/src/web/index.php

@@ -111,6 +111,8 @@ $dayStats = $conn->getDayBettingsStats();
 <th>Resultat</th>
 <th>Games Played</th>
 <th>Bet amount</th>
+<th>Unresolved</th>
+<th>Wins</th>
 </tr>
 </thead>
 <tbody>
@@ -121,7 +123,9 @@ foreach ($dayStats as $ds) {
     echo "<td>" . $ds['date'] . "</td>";
     echo "<td>" . $ds['sumAmount'] . "</td>";
     echo "<td>" . $ds['numGames'] . "</td>";
-    echo "<td>" . $ds['betAmount'] . "</td>";
+    echo "<td>" . ROUND($ds['betAmount'],2) . "</td>";
+    echo "<td>" . $ds['wins'] . "</td>";
+    echo "<td>" . $ds['pending'] . "</td>";
     echo "</tr>";
     $sum += $ds['sumAmount'];
 }

+ 12 - 0
OddsJavaFx/src/web/webDbConnection.php

@@ -176,6 +176,18 @@ class WebDbConnection {
 		ELSE -amount
 	END
 ),2 ) as sumAmount, 
+SUM(
+    CASE
+        WHEN betOn = '1' AND sr.homeScore > sr.awayScore AND homeScore > -1 AND awayScore > -1 THEN 1
+        WHEN betOn = 'X' AND sr.homeScore = sr.awayScore AND homeScore > -1 AND awayScore > -1 THEN 1
+        WHEN betOn = '2' AND sr.homeScore < sr.awayScore AND homeScore > -1 AND awayScore > -1 THEN 1
+		ELSE 0
+	END as wins, 
+SUM(
+    CASE
+        WHEN homeScore <= -1 AND awayScore <= -1 THEN 1
+		ELSE 0
+	END as pending
 SUM(amount) as betAmount, 
 COUNT(gameDate) as numGames
 FROM `Bets` INNER JOIN SoccerResults sr ON matchId = sr.id GROUP BY DATE(sr.gameDate) ORDER BY sr.gameDate ASC";