<?php include 'bootstrap.php'; // Load data that we will need for the front page $gameMapper = new \IBL\GameMapper($container['db_connection']); $franchiseMapper = new \IBL\FranchiseMapper($container['db_connection']); $rotationMapper = new \IBL\RotationMapper($container['db_connection']); $scheduleMapper = new \IBL\ScheduleMapper($container['db_connection']); $games = $gameMapper->findAll(); $franchises = $franchiseMapper->findAll(); $standings = new \IBL\Standings($games, $franchises); $regularStandings = $standings->generateRegular(); $currentWeek = $gameMapper->getCurrentWeek(); $currentResults = $gameMapper->generateResults($gameMapper->findByWeek($currentWeek), $franchises); /** * If we don't have any rotations for the current week, make sure to grab * rotations for the previous week */ $rotations = $rotationMapper->findByWeek($currentWeek); $rotationWeek = $currentWeek; if (count($rotations) == 0) { $rotations = $rotationMapper->findByWeek($currentWeek - 1); $rotationWeek = $currentWeek - 1; } $currentRotations = $rotationMapper->generateRotations($rotations, $franchises); /** * We need to use some intelligence in deciding what schedules we need to * show. If we have less than half the results in, show the schedule * from the previous week */ if (count($currentResults) < 12) {
public function testFindByWeek() { $mapper = new \IBL\GameMapper($this->_conn); $results = $mapper->findByWeek(10); $this->assertEquals(count($results), 72); }
<?php include 'test_bootstrap.php'; $conn = new PDO('pgsql:host=localhost;dbname=ibl_stats', 'stats', 'st@ts=Fun'); echo "Collecting all games for week 27...\n"; $gameMapper = new \IBL\GameMapper($conn); $allGames = $gameMapper->findByWeek(27); echo "Writing games objects into fixture file...\n"; file_put_contents('./fixtures/games-27.txt', serialize($allGames)); echo "Done\n";