Live reloading dashboard galore!!! yeaaaaaah
This commit is contained in:
parent
822fad26cf
commit
8bc6ab8750
22
css/app.css
22
css/app.css
@ -24,24 +24,10 @@ body {
|
||||
}
|
||||
|
||||
|
||||
/*Animations*/
|
||||
|
||||
/* The starting CSS styles for the enter animation */
|
||||
.fade.ng-enter {
|
||||
transition:0.5s linear all;
|
||||
opacity:0;
|
||||
/* */
|
||||
div.team-col {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
/* The finishing CSS styles for the enter animation */
|
||||
.fade.ng-enter.ng-enter-active {
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
/* now the element will fade out before it is removed from the DOM */
|
||||
.fade.ng-leave {
|
||||
transition:0.5s linear all;
|
||||
opacity:1;
|
||||
}
|
||||
.fade.ng-leave.ng-leave-active {
|
||||
opacity:0;
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
var mod = angular.module('bananaraceApp.controllers', ['ngAnimate']);
|
||||
var mod = angular.module('bananaraceApp.controllers');
|
||||
|
||||
|
||||
mod.controller('PouleViewerCtrl', ['$scope', '$routeParams', 'ViewerService',
|
||||
function($scope, $routeParams, ViewerService) {
|
||||
mod.controller('PouleViewerCtrl', ['$scope', '$routeParams', 'ViewerService', '$interval',
|
||||
function($scope, $routeParams, ViewerService, $interval) {
|
||||
|
||||
//store all the teams
|
||||
$scope.teamsInPoule = [];
|
||||
@ -30,5 +30,11 @@ mod.controller('PouleViewerCtrl', ['$scope', '$routeParams', 'ViewerService',
|
||||
};
|
||||
|
||||
$scope.refreshTeamsForPoule();
|
||||
var timer = $interval($scope.refreshTeamsForPoule, 1000);
|
||||
|
||||
// Cancel timer on destroying controller
|
||||
$scope.$on('$destroy', function() {
|
||||
$interval.cancel(timer);
|
||||
});
|
||||
}
|
||||
]);
|
||||
@ -13,20 +13,45 @@ var mod = angular.module('bananaraceApp.filters', []);
|
||||
|
||||
mod.filter('secondsToString', function() {
|
||||
return function(seconds) {
|
||||
var minutes = Math.floor(seconds/60);
|
||||
var secondsleft = seconds-(minutes*60);
|
||||
var minutes = Math.floor(seconds / 60);
|
||||
var secondsleft = seconds - (minutes * 60);
|
||||
|
||||
var padWithZeroes = function(input, desiredlength) {
|
||||
var str = input+"";
|
||||
while(str.length<desiredlength) {
|
||||
str = "0"+str;
|
||||
}
|
||||
return str;
|
||||
};
|
||||
var padWithZeroes = function(input, desiredlength) {
|
||||
var str = input + "";
|
||||
while (str.length < desiredlength) {
|
||||
str = "0" + str;
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
var seconds = Math.floor(secondsleft);
|
||||
var decimals = secondsleft-seconds;
|
||||
var seconds = Math.floor(secondsleft);
|
||||
var decimals = secondsleft - seconds;
|
||||
|
||||
return padWithZeroes(minutes, 2)+':'+padWithZeroes(seconds, 2)+"."+padWithZeroes(Math.floor(decimals*10),1);
|
||||
return padWithZeroes(minutes, 2) + ':' + padWithZeroes(seconds, 2) + "." + padWithZeroes(Math.floor(decimals * 10), 1);
|
||||
};
|
||||
});
|
||||
|
||||
mod.filter('interval', function() {
|
||||
return function(input) {
|
||||
if (!input) {
|
||||
return undefined;
|
||||
}
|
||||
var parts = input.split('.');
|
||||
var ms = 0;
|
||||
if (parts.length == 2) {
|
||||
// microseconds available
|
||||
ms = parts[1];
|
||||
ms /= Math.pow(10, (ms.length - 1));
|
||||
ms = Math.round(ms);
|
||||
ms = ms == 10 ? 1 : ms;
|
||||
}
|
||||
var pieces = parts[0].split(':');
|
||||
var hours = pieces[0];
|
||||
var mins = pieces[1];
|
||||
var secs = pieces[2];
|
||||
|
||||
var totalMins = hours * 60 + parseInt(mins);
|
||||
totalMins = totalMins < 10 ? '0' + totalMins : totalMins;
|
||||
return totalMins + ':' + secs + '.' + ms;
|
||||
}
|
||||
});
|
||||
452
js/services.js
452
js/services.js
@ -5,233 +5,345 @@
|
||||
var appServices = angular.module('bananaraceApp.services', []);
|
||||
|
||||
appServices.service('ChampionshipService', function($http) {
|
||||
this.getChampionships = function() {
|
||||
console.log('service.getChampionships called');
|
||||
return $http.post('server/getchampionships.php', {});
|
||||
};
|
||||
this.getChampionships = function() {
|
||||
console.log('service.getChampionships called');
|
||||
return $http.post('server/getchampionships.php', {});
|
||||
};
|
||||
|
||||
this.deleteChampionship = function(championship) {
|
||||
return $http.post('server/deletechampionship.php', {idchampionship:championship.idchampionship});
|
||||
};
|
||||
this.deleteChampionship = function(championship) {
|
||||
return $http.post('server/deletechampionship.php', {
|
||||
idchampionship: championship.idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
this.addChampionship = function(newchampionship) {
|
||||
return $http.post('server/addchampionship.php', {name:newchampionship.name});
|
||||
};
|
||||
this.addChampionship = function(newchampionship) {
|
||||
return $http.post('server/addchampionship.php', {
|
||||
name: newchampionship.name
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
appServices.service('PouleService', function($http) {
|
||||
this.getPoules = function(idchampionship) {
|
||||
return $http.post('server/getpoules.php', {idchampionship:idchampionship});
|
||||
};
|
||||
this.getPoules = function(idchampionship) {
|
||||
return $http.post('server/getpoules.php', {
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
this.addPoule = function(newpoule, idchampionship) {
|
||||
return $http.post('server/addpoule.php', {tier:newpoule.tier, poule:newpoule.poule, idchampionship:idchampionship});
|
||||
};
|
||||
this.addPoule = function(newpoule, idchampionship) {
|
||||
return $http.post('server/addpoule.php', {
|
||||
tier: newpoule.tier,
|
||||
poule: newpoule.poule,
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
this.deletePoule = function(tier, poule, idchampionship) {
|
||||
return $http.post('server/deletepoule.php', {tier:tier, poule:poule, idchampionship:idchampionship});
|
||||
};
|
||||
this.deletePoule = function(tier, poule, idchampionship) {
|
||||
return $http.post('server/deletepoule.php', {
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
this.addTeam = function(team, idchampionship, tier, poule) {
|
||||
return $http.post('server/addteamtopoule.php', {idteam:team.idteam, tier:tier, poule:poule, idchampionship:idchampionship});
|
||||
};
|
||||
this.addTeam = function(team, idchampionship, tier, poule) {
|
||||
return $http.post('server/addteamtopoule.php', {
|
||||
idteam: team.idteam,
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
this.removeTeam = function(team, idchampionship, tier, poule) {
|
||||
return $http.post('server/removeteamfrompoule.php', {idteam:team.idteam, tier:tier, poule:poule, idchampionship:idchampionship});
|
||||
};
|
||||
this.removeTeam = function(team, idchampionship, tier, poule) {
|
||||
return $http.post('server/removeteamfrompoule.php', {
|
||||
idteam: team.idteam,
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
this.getRacesInPoule = function(idchampionship, tier, poule) {
|
||||
return $http.post('server/getracesinpoule.php', {tier:tier, poule:poule, idchampionship:idchampionship});
|
||||
};
|
||||
this.getRacesInPoule = function(idchampionship, tier, poule) {
|
||||
return $http.post('server/getracesinpoule.php', {
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
this.addRace = function(idchampionship, tier, poule, idteam) {
|
||||
return $http.post('server/addracetopoule.php', {tier:tier, poule:poule, idchampionship:idchampionship, idteam:idteam});
|
||||
};
|
||||
this.addRace = function(idchampionship, tier, poule, idteam) {
|
||||
return $http.post('server/addracetopoule.php', {
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
idchampionship: idchampionship,
|
||||
idteam: idteam
|
||||
});
|
||||
};
|
||||
|
||||
this.deleteRace = function(idchampionship, tier, poule, idrace) {
|
||||
return $http.post('server/deleterace.php', {tier:tier, poule:poule, idchampionship:idchampionship, idrace:idrace});
|
||||
};
|
||||
this.deleteRace = function(idchampionship, tier, poule, idrace) {
|
||||
return $http.post('server/deleterace.php', {
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
idchampionship: idchampionship,
|
||||
idrace: idrace
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
appServices.service('TeamService', function($http) {
|
||||
this.getTeams = function(idchampionship) {
|
||||
return $http.post('server/getteams.php', {idchampionship:idchampionship});
|
||||
};
|
||||
this.getTeams = function(idchampionship) {
|
||||
return $http.post('server/getteams.php', {
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
this.getTeamsInPoule = function(idchampionship, tier, poule) {
|
||||
return $http.post('server/getteams.php', {idchampionship:idchampionship, tier:tier, poule:poule});
|
||||
};
|
||||
this.getTeamsInPoule = function(idchampionship, tier, poule) {
|
||||
return $http.post('server/getteams.php', {
|
||||
idchampionship: idchampionship,
|
||||
tier: tier,
|
||||
poule: poule
|
||||
});
|
||||
};
|
||||
|
||||
this.deleteTeam = function(team, idchampionship) {
|
||||
return $http.post('server/deleteteam.php', {idteam:team.idteam, idchampionship:idchampionship});
|
||||
};
|
||||
this.deleteTeam = function(team, idchampionship) {
|
||||
return $http.post('server/deleteteam.php', {
|
||||
idteam: team.idteam,
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Filters: teams that are from the given championship and haven't been used in another poule...
|
||||
*/
|
||||
this.getTeamsAvailableForPoule = function(idchampionship, tier, poule) {
|
||||
return $http.post('server/getteams.php', {idchampionship:idchampionship, tier:tier, poule:poule, available:true});
|
||||
};
|
||||
/**
|
||||
* Filters: teams that are from the given championship and haven't been used in another poule...
|
||||
*/
|
||||
this.getTeamsAvailableForPoule = function(idchampionship, tier, poule) {
|
||||
return $http.post('server/getteams.php', {
|
||||
idchampionship: idchampionship,
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
available: true
|
||||
});
|
||||
};
|
||||
|
||||
this.addTeam = function(newteam, idchampionship) {
|
||||
console.log('adding team');
|
||||
return $http.post('server/addteam.php', {name:newteam.name, idchampionship:idchampionship});
|
||||
};
|
||||
this.addTeam = function(newteam, idchampionship) {
|
||||
console.log('adding team');
|
||||
return $http.post('server/addteam.php', {
|
||||
name: newteam.name,
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
appServices.service('RaceService', function($http) {
|
||||
this.getDrives = function(idrace) {
|
||||
return $http.post('server/getdrives.php', {idrace:idrace});
|
||||
};
|
||||
this.getDrives = function(idrace) {
|
||||
return $http.post('server/getdrives.php', {
|
||||
idrace: idrace
|
||||
});
|
||||
};
|
||||
|
||||
this.getTeam = function(idrace) {
|
||||
return $http.post('server/getraceteam.php', {idrace:idrace});
|
||||
};
|
||||
this.getTeam = function(idrace) {
|
||||
return $http.post('server/getraceteam.php', {
|
||||
idrace: idrace
|
||||
});
|
||||
};
|
||||
|
||||
this.addDrive = function(race, driver, laps) {
|
||||
return $http.post('server/adddrive.php', {idrace:race, iddriver:driver.iddriver, laps});
|
||||
};
|
||||
this.addDrive = function(race, driver, laps) {
|
||||
return $http.post('server/adddrive.php', {
|
||||
idrace: race,
|
||||
iddriver: driver.iddriver,
|
||||
laps: laps
|
||||
});
|
||||
};
|
||||
|
||||
this.deleteDrive = function(drivenr, idrace) {
|
||||
return $http.post('server/deletedrive.php', {drivenr:drivenr, idrace:idrace});
|
||||
};
|
||||
this.deleteDrive = function(drivenr, idrace) {
|
||||
return $http.post('server/deletedrive.php', {
|
||||
drivenr: drivenr,
|
||||
idrace: idrace
|
||||
});
|
||||
};
|
||||
|
||||
this.addMeasurementNow = function(idrace) {
|
||||
return $http.post('server/addmeasurement.php', {type:'now', idrace:idrace});
|
||||
};
|
||||
this.addMeasurementNow = function(idrace) {
|
||||
return $http.post('server/addmeasurement.php', {
|
||||
type: 'now',
|
||||
idrace: idrace
|
||||
});
|
||||
};
|
||||
|
||||
this.addMeasurementRelative = function(idrace, timestamp) {
|
||||
return $http.post('server/addmeasurement.php', {type:'relative', idrace:idrace, timestamp:timestamp});
|
||||
};
|
||||
this.addMeasurementRelative = function(idrace, timestamp) {
|
||||
return $http.post('server/addmeasurement.php', {
|
||||
type: 'relative',
|
||||
idrace: idrace,
|
||||
timestamp: timestamp
|
||||
});
|
||||
};
|
||||
|
||||
this.getMeasurements = function(idrace) {
|
||||
return $http.post('server/getmeasurements.php', {idrace:idrace});
|
||||
};
|
||||
this.getMeasurements = function(idrace) {
|
||||
return $http.post('server/getmeasurements.php', {
|
||||
idrace: idrace
|
||||
});
|
||||
};
|
||||
|
||||
this.updateMeasurement = function(measurement) {
|
||||
return $http.post('server/updatemeasurement.php', {idmeasurement:measurement.idmeasurement, valid:measurement.valid});
|
||||
};
|
||||
this.updateMeasurement = function(measurement) {
|
||||
return $http.post('server/updatemeasurement.php', {
|
||||
idmeasurement: measurement.idmeasurement,
|
||||
valid: measurement.valid
|
||||
});
|
||||
};
|
||||
|
||||
this.deleteMeasurement = function(measurement) {
|
||||
console.log('deleting measurement');
|
||||
console.log(measurement);
|
||||
return $http.post('server/deletemeasurement.php', {idmeasurement:measurement.idmeasurement});
|
||||
};
|
||||
this.deleteMeasurement = function(measurement) {
|
||||
console.log('deleting measurement');
|
||||
console.log(measurement);
|
||||
return $http.post('server/deletemeasurement.php', {
|
||||
idmeasurement: measurement.idmeasurement
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
appServices.service('DriverService', function($http) {
|
||||
this.getDrivers = function(idchampionship, idteam) {
|
||||
return $http.post('server/getdrivers.php', {idchampionship:idchampionship, idteam:idteam});
|
||||
};
|
||||
this.getDrivers = function(idchampionship, idteam) {
|
||||
return $http.post('server/getdrivers.php', {
|
||||
idchampionship: idchampionship,
|
||||
idteam: idteam
|
||||
});
|
||||
};
|
||||
|
||||
this.addDriver = function(newdriver, idchampionship, idteam) {
|
||||
console.log('adding driver');
|
||||
return $http.post('server/adddriver.php', {idchampionship:idchampionship, name:newdriver.name, idteam:idteam});
|
||||
};
|
||||
this.addDriver = function(newdriver, idchampionship, idteam) {
|
||||
console.log('adding driver');
|
||||
return $http.post('server/adddriver.php', {
|
||||
idchampionship: idchampionship,
|
||||
name: newdriver.name,
|
||||
idteam: idteam
|
||||
});
|
||||
};
|
||||
|
||||
this.deleteDriver = function(driver) {
|
||||
console.log('removing driver');
|
||||
return $http.post('server/deletedriver.php', {iddriver:driver.iddriver});
|
||||
};
|
||||
this.deleteDriver = function(driver) {
|
||||
console.log('removing driver');
|
||||
return $http.post('server/deletedriver.php', {
|
||||
iddriver: driver.iddriver
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
appServices.service('DriveService', function($http) {
|
||||
this.getComments = function(idrace, drivenr) {
|
||||
console.log('getting comments for: '+idrace+' '+drivenr);
|
||||
return $http.post('server/getcomments.php', {idrace:idrace, drivenr:drivenr});
|
||||
};
|
||||
this.getComments = function(idrace, drivenr) {
|
||||
console.log('getting comments for: ' + idrace + ' ' + drivenr);
|
||||
return $http.post('server/getcomments.php', {
|
||||
idrace: idrace,
|
||||
drivenr: drivenr
|
||||
});
|
||||
};
|
||||
|
||||
this.addComment = function(idrace, drivenr, comment, penaltyseconds) {
|
||||
return $http.post('server/addcomment.php', {idrace:idrace, drivenr:drivenr, comment:comment, penaltyseconds:penaltyseconds});
|
||||
};
|
||||
this.addComment = function(idrace, drivenr, comment, penaltyseconds) {
|
||||
return $http.post('server/addcomment.php', {
|
||||
idrace: idrace,
|
||||
drivenr: drivenr,
|
||||
comment: comment,
|
||||
penaltyseconds: penaltyseconds
|
||||
});
|
||||
};
|
||||
|
||||
this.deleteComment = function(idcomment) {
|
||||
return $http.post('server/deletecomment.php', {idcomment:idcomment});
|
||||
};
|
||||
this.deleteComment = function(idcomment) {
|
||||
return $http.post('server/deletecomment.php', {
|
||||
idcomment: idcomment
|
||||
});
|
||||
};
|
||||
|
||||
this.deleteDriver = function(driver) {
|
||||
console.log('removing driver');
|
||||
return $http.post('server/deletedriver.php', {iddriver:driver.iddriver});
|
||||
};
|
||||
this.deleteDriver = function(driver) {
|
||||
console.log('removing driver');
|
||||
return $http.post('server/deletedriver.php', {
|
||||
iddriver: driver.iddriver
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
appServices.service('OverviewService', function($http) {
|
||||
this.getData = function(idchampionship) {
|
||||
return $http.post('server/getoverviewofchampionship.php', {idchampionship:idchampionship});
|
||||
};
|
||||
this.getData = function(idchampionship) {
|
||||
return $http.post('server/getoverviewofchampionship.php', {
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
appServices.service('ViewerService', function($http) {
|
||||
this.getTeamsForPoule = function(idchampionship, tier, poule) {
|
||||
return $http.post('server/getteamsforpoule.php', {tier:tier, poule:poule, idchampionship:idchampionship});
|
||||
};
|
||||
this.getTeamsForPoule = function(idchampionship, tier, poule) {
|
||||
return $http.post('server/getteamsforpoule.php', {
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
idchampionship: idchampionship
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
appServices.service('MainService', function($http, $cookies) {
|
||||
|
||||
var activerace = null;
|
||||
var activerace = null;
|
||||
|
||||
this.refreshConfig = function() {
|
||||
$http.post('server/config.php', {action:'getConfig'}).
|
||||
success(function(data, status, headers, config) {
|
||||
// console.log('refreshConfig successful...');
|
||||
//refresh activerace
|
||||
if(data.activeidrace != null) {
|
||||
// console.log('setting the activerace...');
|
||||
activerace = {
|
||||
idrace:data.activeidrace,
|
||||
tier:data.tier,
|
||||
poule:data.poule,
|
||||
idchampionship:data.idchampionship
|
||||
};
|
||||
} else {
|
||||
// console.log('idrace was null, setting activerace to null');
|
||||
activerace = null;
|
||||
}
|
||||
console.log(activerace);
|
||||
}).
|
||||
error(function(data, status, headers, config) {
|
||||
console.log('getConfig failed...');
|
||||
});
|
||||
};
|
||||
this.refreshConfig = function() {
|
||||
$http.post('server/config.php', {
|
||||
action: 'getConfig'
|
||||
}).
|
||||
success(function(data, status, headers, config) {
|
||||
// console.log('refreshConfig successful...');
|
||||
//refresh activerace
|
||||
if (data.activeidrace != null) {
|
||||
// console.log('setting the activerace...');
|
||||
activerace = {
|
||||
idrace: data.activeidrace,
|
||||
tier: data.tier,
|
||||
poule: data.poule,
|
||||
idchampionship: data.idchampionship
|
||||
};
|
||||
} else {
|
||||
// console.log('idrace was null, setting activerace to null');
|
||||
activerace = null;
|
||||
}
|
||||
console.log(activerace);
|
||||
}).
|
||||
error(function(data, status, headers, config) {
|
||||
console.log('getConfig failed...');
|
||||
});
|
||||
};
|
||||
|
||||
this.setActiveRace = function(idrace, tier, poule, idchampionship) {
|
||||
if(idrace == null) {
|
||||
activerace = null;
|
||||
} else {
|
||||
activerace = {
|
||||
idrace:idrace,
|
||||
tier:tier,
|
||||
poule:poule,
|
||||
idchampionship:idchampionship
|
||||
};
|
||||
}
|
||||
$http.post('server/config.php', {action:'setActiveIdRace', idrace:idrace}).
|
||||
success(function(data, status, headers, config) {
|
||||
//do something?
|
||||
});
|
||||
};
|
||||
this.setActiveRace = function(idrace, tier, poule, idchampionship) {
|
||||
if (idrace == null) {
|
||||
activerace = null;
|
||||
} else {
|
||||
activerace = {
|
||||
idrace: idrace,
|
||||
tier: tier,
|
||||
poule: poule,
|
||||
idchampionship: idchampionship
|
||||
};
|
||||
}
|
||||
$http.post('server/config.php', {
|
||||
action: 'setActiveIdRace',
|
||||
idrace: idrace
|
||||
}).
|
||||
success(function(data, status, headers, config) {
|
||||
//do something?
|
||||
});
|
||||
};
|
||||
|
||||
this.getActiveRace = function() {
|
||||
return activerace;
|
||||
};
|
||||
this.getActiveRace = function() {
|
||||
return activerace;
|
||||
};
|
||||
|
||||
this.toggleActiveRace = function(idrace, tier, poule, idchampionship) {
|
||||
console.log('toggling active race'+idrace);
|
||||
//if the race is not the same as the currently active on: switch it
|
||||
if(activerace == null || activerace.idrace!=idrace) {
|
||||
this.setActiveRace(idrace, tier, poule, idchampionship);
|
||||
} else {
|
||||
//well, it's the same: we're disabling the activeness of the race
|
||||
activerace = null;
|
||||
this.setActiveRace(null, null, null, null);
|
||||
}
|
||||
};
|
||||
this.toggleActiveRace = function(idrace, tier, poule, idchampionship) {
|
||||
console.log('toggling active race' + idrace);
|
||||
//if the race is not the same as the currently active on: switch it
|
||||
if (activerace == null || activerace.idrace != idrace) {
|
||||
this.setActiveRace(idrace, tier, poule, idchampionship);
|
||||
} else {
|
||||
//well, it's the same: we're disabling the activeness of the race
|
||||
activerace = null;
|
||||
this.setActiveRace(null, null, null, null);
|
||||
}
|
||||
};
|
||||
|
||||
//load the current config
|
||||
this.refreshConfig();
|
||||
});
|
||||
//load the current config
|
||||
this.refreshConfig();
|
||||
});
|
||||
@ -11,15 +11,15 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-inline">
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="form-group form-group-sm" style="display:inline-block">
|
||||
<label for="tierInput">Tier</label>
|
||||
<input type="text" class="form-control" id="tierInput" aria-describedby="sizing-addon2" ng-model="newpoule.tier" style="width:50px"/>
|
||||
<input type="text" class="form-control" id="tierInput" aria-describedby="sizing-addon2" ng-model="newpoule.tier" style="width:50px; display:inline-block"/>
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="form-group form-group-sm" style="display:inline-block">
|
||||
<label for="pouleInput">Poule</label>
|
||||
<input type="text" class="form-control" id="pouleInput" aria-describedby="sizing-addon2" ng-model="newpoule.poule" style="width:50px"/>
|
||||
<input type="text" class="form-control" id="pouleInput" aria-describedby="sizing-addon2" ng-model="newpoule.poule" style="width:50px; display:inline-block"/>
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-default btn-success" ng-click="addPoule(newpoule)">Toevoegen</button>
|
||||
<button type="button" class="btn btn-sm btn-success" ng-click="addPoule(newpoule)">Toevoegen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<span class="input-group-addon" id="sizing-addon2">Naam</span>
|
||||
<input type="text" class="form-control" aria-describedby="sizing-addon2" ng-model="newchampionship.name">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-default btn-success" ng-click="addChampionship(newchampionship);">Toevoegen</button>
|
||||
<button type="button" class="btn btn-success" ng-click="addChampionship(newchampionship);">Toevoegen</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -5,28 +5,23 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- every team gets a column -->
|
||||
<div class="col-xs-2" ng-repeat="team in teamsInPoule">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="team-col pull-left" ng-repeat="team in teamsInPoule" ng-style="{'width':(100/teamsInPoule.length)+'%'}">
|
||||
<h2>{{team.teamname}}</h2>
|
||||
</div>
|
||||
<!-- and that column is filled with rows: each row is a laptime -->
|
||||
<div class="row" ng-repeat="race in team.races">
|
||||
<div ng-repeat="race in team.races">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Race {{race.idrace}}</h3>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Race {{race.idrace}}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div ng-repeat="laptime in race.laptimes">{{laptime.laptime | interval}}</div>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
@ -15,14 +15,14 @@
|
||||
|
||||
//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");
|
||||
$result['lasterror'].=pg_last_error()."\n";
|
||||
// $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");
|
||||
$result['lasterror'].=pg_last_error()."\n";
|
||||
// $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");
|
||||
$result['lasterror'].=pg_last_error()."\n";
|
||||
// $result['lasterror'].=pg_last_error()."\n";
|
||||
|
||||
$teamfetch = pg_execute($dbconn, "teamfetch", array($tier, $poule, $idchampionship));
|
||||
$result['lasterror'].=pg_last_error()."\n";
|
||||
// $result['lasterror'].=pg_last_error()."\n";
|
||||
|
||||
//resulting teams array
|
||||
$teams = array();
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
//loop over each race
|
||||
$racefetchexec = pg_execute($dbconn, "racefetch", array($tier, $poule, $idchampionship, $idteam));
|
||||
$result['lasterror'].=pg_last_error()."\n";
|
||||
// $result['lasterror'].=pg_last_error()."\n";
|
||||
|
||||
while($racerow = pg_fetch_assoc($racefetchexec)) {
|
||||
$result['GETTING IN IT'] = true;
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
//fetch the laptimes
|
||||
$laptimefetch = pg_execute($dbconn, "laptimefetch", array($race['idrace']));
|
||||
$result['lasterror'].=pg_last_error()."\n";
|
||||
// $result['lasterror'].=pg_last_error()."\n";
|
||||
while($laptimerow = pg_fetch_assoc($laptimefetch)) {
|
||||
$laptime = array();
|
||||
$laptime['laptime'] = $laptimerow['laptime'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user