hier thomas, geniet ervan
This commit is contained in:
parent
4bbd081de6
commit
58be9c6c90
@ -8,12 +8,25 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- every team gets a column -->
|
<!-- every team gets a column -->
|
||||||
<div class="col-xs-2" ng-repeat="team in teamsInPoule">
|
<div class="col-xs-2" ng-repeat="team in teamsInPoule">
|
||||||
|
<div class="row">
|
||||||
|
<h2>{{team.teamname}}</h2>
|
||||||
|
</div>
|
||||||
<!-- and that column is filled with rows: each row is a laptime -->
|
<!-- and that column is filled with rows: each row is a laptime -->
|
||||||
<div class="row" ng-repeat="race in team.races">
|
<div class="row" ng-repeat="race in team.races">
|
||||||
race: {{race.idrace}}
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Race {{race.idrace}}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item" ng-repeat="laptime in race.laptimes">{{laptime.laptime}}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-repeat="team in teamsInPoule">
|
|
||||||
naam: {{team.teamname}}
|
|
||||||
</div>
|
|
||||||
|
|||||||
@ -15,30 +15,38 @@
|
|||||||
|
|
||||||
//fetch teams
|
//fetch teams
|
||||||
$teamfetch = pg_prepare($dbconn, "teamfetch", "select team.*, team.name teamname from team inner join team_poule using (idteam, idchampionship) where tier = $1 and poule = $2 and idchampionship = $3");
|
$teamfetch = pg_prepare($dbconn, "teamfetch", "select team.*, team.name teamname from team inner join team_poule using (idteam, idchampionship) where tier = $1 and poule = $2 and idchampionship = $3");
|
||||||
|
$result['lasterror'].=pg_last_error()."\n";
|
||||||
$racefetch = pg_prepare($dbconn, "racefetch", "select * from race where tier = $1 and poule = $2 and idchampionship = $3 and idteam = $4");
|
$racefetch = pg_prepare($dbconn, "racefetch", "select * from race where tier = $1 and poule = $2 and idchampionship = $3 and idteam = $4");
|
||||||
|
$result['lasterror'].=pg_last_error()."\n";
|
||||||
$laptimefetch = pg_prepare($dbconn, "laptimefetch", "select vm1.idrace, vm2.cleaneduptime-vm1.cleaneduptime laptime from valid_measurements vm1 inner join valid_measurements vm2 on vm1.idrace = vm2.idrace and vm1.idmeasurement != vm2.idmeasurement and vm1.cleaneduptime < vm2.cleaneduptime and vm2.cleaneduptime = (select min(cleaneduptime) from valid_measurements vm3 where vm3.cleaneduptime>vm1.cleaneduptime and vm3.idrace = vm1.idrace) where vm1.idrace = $1 order by vm1.idrace, laptime");
|
$laptimefetch = pg_prepare($dbconn, "laptimefetch", "select vm1.idrace, vm2.cleaneduptime-vm1.cleaneduptime laptime from valid_measurements vm1 inner join valid_measurements vm2 on vm1.idrace = vm2.idrace and vm1.idmeasurement != vm2.idmeasurement and vm1.cleaneduptime < vm2.cleaneduptime and vm2.cleaneduptime = (select min(cleaneduptime) from valid_measurements vm3 where vm3.cleaneduptime>vm1.cleaneduptime and vm3.idrace = vm1.idrace) where vm1.idrace = $1 order by vm1.idrace, laptime");
|
||||||
|
$result['lasterror'].=pg_last_error()."\n";
|
||||||
|
|
||||||
$teamfetch = pg_execute($dbconn, "teamfetch", array($tier, $poule, $idchampionship));
|
$teamfetch = pg_execute($dbconn, "teamfetch", array($tier, $poule, $idchampionship));
|
||||||
|
$result['lasterror'].=pg_last_error()."\n";
|
||||||
|
|
||||||
//resulting teams array
|
//resulting teams array
|
||||||
$teams = array();
|
$teams = array();
|
||||||
while($row = pg_fetch_assoc($teamfetch)) {
|
while($row = pg_fetch_assoc($teamfetch)) {
|
||||||
$team = $row;
|
$team = $row;
|
||||||
$team['races'] = array();
|
$team['races'] = array();
|
||||||
|
$idteam = $row['idteam'];
|
||||||
|
|
||||||
|
$result['debugracefetch'] = $tier.' '.$poule.' '.$idchampionship.' '.$idteam;
|
||||||
|
|
||||||
//loop over each race
|
//loop over each race
|
||||||
$racefetch = pg_execute($dbconn, "racefetch", array($tier, $poule, $idchampionship, $idteam));
|
$racefetchexec = pg_execute($dbconn, "racefetch", array($tier, $poule, $idchampionship, $idteam));
|
||||||
if($racefetch===false) {
|
$result['lasterror'].=pg_last_error()."\n";
|
||||||
$result['debug1'].=pg_last_error($dbconn);
|
|
||||||
}
|
|
||||||
while($racerow = pg_fetch_assoc($racefetch)) {
|
|
||||||
|
|
||||||
|
while($racerow = pg_fetch_assoc($racefetchexec)) {
|
||||||
|
$result['GETTING IN IT'] = true;
|
||||||
$race = array();
|
$race = array();
|
||||||
|
|
||||||
$race['idrace'] = $racerow['idrace'];
|
$race['idrace'] = $racerow['idrace'];
|
||||||
$race['laptimes'] = array();
|
$race['laptimes'] = array();
|
||||||
|
|
||||||
//fetch the laptimes
|
//fetch the laptimes
|
||||||
$laptimefetch = pg_execute($dbconn, "laptimefetch", array($race['idrace']));
|
$laptimefetch = pg_execute($dbconn, "laptimefetch", array($race['idrace']));
|
||||||
|
$result['lasterror'].=pg_last_error()."\n";
|
||||||
while($laptimerow = pg_fetch_assoc($laptimefetch)) {
|
while($laptimerow = pg_fetch_assoc($laptimefetch)) {
|
||||||
$laptime = array();
|
$laptime = array();
|
||||||
$laptime['laptime'] = $laptimerow['laptime'];
|
$laptime['laptime'] = $laptimerow['laptime'];
|
||||||
@ -46,8 +54,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$team['races'][] = $race;
|
$team['races'][] = $race;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$teams[] = $team;
|
$teams[] = $team;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user