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*/
|
/* */
|
||||||
|
div.team-col {
|
||||||
/* The starting CSS styles for the enter animation */
|
padding: 5px;
|
||||||
.fade.ng-enter {
|
|
||||||
transition:0.5s linear all;
|
|
||||||
opacity:0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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',
|
mod.controller('PouleViewerCtrl', ['$scope', '$routeParams', 'ViewerService', '$interval',
|
||||||
function($scope, $routeParams, ViewerService) {
|
function($scope, $routeParams, ViewerService, $interval) {
|
||||||
|
|
||||||
//store all the teams
|
//store all the teams
|
||||||
$scope.teamsInPoule = [];
|
$scope.teamsInPoule = [];
|
||||||
@ -30,5 +30,11 @@ mod.controller('PouleViewerCtrl', ['$scope', '$routeParams', 'ViewerService',
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.refreshTeamsForPoule();
|
$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() {
|
mod.filter('secondsToString', function() {
|
||||||
return function(seconds) {
|
return function(seconds) {
|
||||||
var minutes = Math.floor(seconds/60);
|
var minutes = Math.floor(seconds / 60);
|
||||||
var secondsleft = seconds-(minutes*60);
|
var secondsleft = seconds - (minutes * 60);
|
||||||
|
|
||||||
var padWithZeroes = function(input, desiredlength) {
|
var padWithZeroes = function(input, desiredlength) {
|
||||||
var str = input+"";
|
var str = input + "";
|
||||||
while(str.length<desiredlength) {
|
while (str.length < desiredlength) {
|
||||||
str = "0"+str;
|
str = "0" + str;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
var seconds = Math.floor(secondsleft);
|
var seconds = Math.floor(secondsleft);
|
||||||
var decimals = secondsleft-seconds;
|
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;
|
||||||
|
}
|
||||||
|
});
|
||||||
208
js/services.js
208
js/services.js
@ -11,163 +11,270 @@ appServices.service('ChampionshipService', function($http) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.deleteChampionship = function(championship) {
|
this.deleteChampionship = function(championship) {
|
||||||
return $http.post('server/deletechampionship.php', {idchampionship:championship.idchampionship});
|
return $http.post('server/deletechampionship.php', {
|
||||||
|
idchampionship: championship.idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addChampionship = function(newchampionship) {
|
this.addChampionship = function(newchampionship) {
|
||||||
return $http.post('server/addchampionship.php', {name:newchampionship.name});
|
return $http.post('server/addchampionship.php', {
|
||||||
|
name: newchampionship.name
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
appServices.service('PouleService', function($http) {
|
appServices.service('PouleService', function($http) {
|
||||||
this.getPoules = function(idchampionship) {
|
this.getPoules = function(idchampionship) {
|
||||||
return $http.post('server/getpoules.php', {idchampionship:idchampionship});
|
return $http.post('server/getpoules.php', {
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addPoule = function(newpoule, idchampionship) {
|
this.addPoule = function(newpoule, idchampionship) {
|
||||||
return $http.post('server/addpoule.php', {tier:newpoule.tier, poule:newpoule.poule, idchampionship:idchampionship});
|
return $http.post('server/addpoule.php', {
|
||||||
|
tier: newpoule.tier,
|
||||||
|
poule: newpoule.poule,
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deletePoule = function(tier, poule, idchampionship) {
|
this.deletePoule = function(tier, poule, idchampionship) {
|
||||||
return $http.post('server/deletepoule.php', {tier:tier, poule:poule, idchampionship:idchampionship});
|
return $http.post('server/deletepoule.php', {
|
||||||
|
tier: tier,
|
||||||
|
poule: poule,
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addTeam = function(team, idchampionship, tier, poule) {
|
this.addTeam = function(team, idchampionship, tier, poule) {
|
||||||
return $http.post('server/addteamtopoule.php', {idteam:team.idteam, tier:tier, poule:poule, idchampionship:idchampionship});
|
return $http.post('server/addteamtopoule.php', {
|
||||||
|
idteam: team.idteam,
|
||||||
|
tier: tier,
|
||||||
|
poule: poule,
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.removeTeam = function(team, idchampionship, tier, poule) {
|
this.removeTeam = function(team, idchampionship, tier, poule) {
|
||||||
return $http.post('server/removeteamfrompoule.php', {idteam:team.idteam, tier:tier, poule:poule, idchampionship:idchampionship});
|
return $http.post('server/removeteamfrompoule.php', {
|
||||||
|
idteam: team.idteam,
|
||||||
|
tier: tier,
|
||||||
|
poule: poule,
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getRacesInPoule = function(idchampionship, tier, poule) {
|
this.getRacesInPoule = function(idchampionship, tier, poule) {
|
||||||
return $http.post('server/getracesinpoule.php', {tier:tier, poule:poule, idchampionship:idchampionship});
|
return $http.post('server/getracesinpoule.php', {
|
||||||
|
tier: tier,
|
||||||
|
poule: poule,
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addRace = function(idchampionship, tier, poule, idteam) {
|
this.addRace = function(idchampionship, tier, poule, idteam) {
|
||||||
return $http.post('server/addracetopoule.php', {tier:tier, poule:poule, idchampionship:idchampionship, idteam:idteam});
|
return $http.post('server/addracetopoule.php', {
|
||||||
|
tier: tier,
|
||||||
|
poule: poule,
|
||||||
|
idchampionship: idchampionship,
|
||||||
|
idteam: idteam
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteRace = function(idchampionship, tier, poule, idrace) {
|
this.deleteRace = function(idchampionship, tier, poule, idrace) {
|
||||||
return $http.post('server/deleterace.php', {tier:tier, poule:poule, idchampionship:idchampionship, idrace:idrace});
|
return $http.post('server/deleterace.php', {
|
||||||
|
tier: tier,
|
||||||
|
poule: poule,
|
||||||
|
idchampionship: idchampionship,
|
||||||
|
idrace: idrace
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
appServices.service('TeamService', function($http) {
|
appServices.service('TeamService', function($http) {
|
||||||
this.getTeams = function(idchampionship) {
|
this.getTeams = function(idchampionship) {
|
||||||
return $http.post('server/getteams.php', {idchampionship:idchampionship});
|
return $http.post('server/getteams.php', {
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getTeamsInPoule = function(idchampionship, tier, poule) {
|
this.getTeamsInPoule = function(idchampionship, tier, poule) {
|
||||||
return $http.post('server/getteams.php', {idchampionship:idchampionship, tier:tier, poule:poule});
|
return $http.post('server/getteams.php', {
|
||||||
|
idchampionship: idchampionship,
|
||||||
|
tier: tier,
|
||||||
|
poule: poule
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteTeam = function(team, idchampionship) {
|
this.deleteTeam = function(team, idchampionship) {
|
||||||
return $http.post('server/deleteteam.php', {idteam:team.idteam, idchampionship: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...
|
* Filters: teams that are from the given championship and haven't been used in another poule...
|
||||||
*/
|
*/
|
||||||
this.getTeamsAvailableForPoule = function(idchampionship, tier, poule) {
|
this.getTeamsAvailableForPoule = function(idchampionship, tier, poule) {
|
||||||
return $http.post('server/getteams.php', {idchampionship:idchampionship, tier:tier, poule:poule, available:true});
|
return $http.post('server/getteams.php', {
|
||||||
|
idchampionship: idchampionship,
|
||||||
|
tier: tier,
|
||||||
|
poule: poule,
|
||||||
|
available: true
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addTeam = function(newteam, idchampionship) {
|
this.addTeam = function(newteam, idchampionship) {
|
||||||
console.log('adding team');
|
console.log('adding team');
|
||||||
return $http.post('server/addteam.php', {name:newteam.name, idchampionship:idchampionship});
|
return $http.post('server/addteam.php', {
|
||||||
|
name: newteam.name,
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
appServices.service('RaceService', function($http) {
|
appServices.service('RaceService', function($http) {
|
||||||
this.getDrives = function(idrace) {
|
this.getDrives = function(idrace) {
|
||||||
return $http.post('server/getdrives.php', {idrace:idrace});
|
return $http.post('server/getdrives.php', {
|
||||||
|
idrace: idrace
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getTeam = function(idrace) {
|
this.getTeam = function(idrace) {
|
||||||
return $http.post('server/getraceteam.php', {idrace:idrace});
|
return $http.post('server/getraceteam.php', {
|
||||||
|
idrace: idrace
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addDrive = function(race, driver, laps) {
|
this.addDrive = function(race, driver, laps) {
|
||||||
return $http.post('server/adddrive.php', {idrace:race, iddriver:driver.iddriver, laps});
|
return $http.post('server/adddrive.php', {
|
||||||
|
idrace: race,
|
||||||
|
iddriver: driver.iddriver,
|
||||||
|
laps: laps
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteDrive = function(drivenr, idrace) {
|
this.deleteDrive = function(drivenr, idrace) {
|
||||||
return $http.post('server/deletedrive.php', {drivenr:drivenr, idrace:idrace});
|
return $http.post('server/deletedrive.php', {
|
||||||
|
drivenr: drivenr,
|
||||||
|
idrace: idrace
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addMeasurementNow = function(idrace) {
|
this.addMeasurementNow = function(idrace) {
|
||||||
return $http.post('server/addmeasurement.php', {type:'now', idrace:idrace});
|
return $http.post('server/addmeasurement.php', {
|
||||||
|
type: 'now',
|
||||||
|
idrace: idrace
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addMeasurementRelative = function(idrace, timestamp) {
|
this.addMeasurementRelative = function(idrace, timestamp) {
|
||||||
return $http.post('server/addmeasurement.php', {type:'relative', idrace:idrace, timestamp:timestamp});
|
return $http.post('server/addmeasurement.php', {
|
||||||
|
type: 'relative',
|
||||||
|
idrace: idrace,
|
||||||
|
timestamp: timestamp
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getMeasurements = function(idrace) {
|
this.getMeasurements = function(idrace) {
|
||||||
return $http.post('server/getmeasurements.php', {idrace:idrace});
|
return $http.post('server/getmeasurements.php', {
|
||||||
|
idrace: idrace
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updateMeasurement = function(measurement) {
|
this.updateMeasurement = function(measurement) {
|
||||||
return $http.post('server/updatemeasurement.php', {idmeasurement:measurement.idmeasurement, valid:measurement.valid});
|
return $http.post('server/updatemeasurement.php', {
|
||||||
|
idmeasurement: measurement.idmeasurement,
|
||||||
|
valid: measurement.valid
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteMeasurement = function(measurement) {
|
this.deleteMeasurement = function(measurement) {
|
||||||
console.log('deleting measurement');
|
console.log('deleting measurement');
|
||||||
console.log(measurement);
|
console.log(measurement);
|
||||||
return $http.post('server/deletemeasurement.php', {idmeasurement:measurement.idmeasurement});
|
return $http.post('server/deletemeasurement.php', {
|
||||||
|
idmeasurement: measurement.idmeasurement
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
appServices.service('DriverService', function($http) {
|
appServices.service('DriverService', function($http) {
|
||||||
this.getDrivers = function(idchampionship, idteam) {
|
this.getDrivers = function(idchampionship, idteam) {
|
||||||
return $http.post('server/getdrivers.php', {idchampionship:idchampionship, idteam:idteam});
|
return $http.post('server/getdrivers.php', {
|
||||||
|
idchampionship: idchampionship,
|
||||||
|
idteam: idteam
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addDriver = function(newdriver, idchampionship, idteam) {
|
this.addDriver = function(newdriver, idchampionship, idteam) {
|
||||||
console.log('adding driver');
|
console.log('adding driver');
|
||||||
return $http.post('server/adddriver.php', {idchampionship:idchampionship, name:newdriver.name, idteam:idteam});
|
return $http.post('server/adddriver.php', {
|
||||||
|
idchampionship: idchampionship,
|
||||||
|
name: newdriver.name,
|
||||||
|
idteam: idteam
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteDriver = function(driver) {
|
this.deleteDriver = function(driver) {
|
||||||
console.log('removing driver');
|
console.log('removing driver');
|
||||||
return $http.post('server/deletedriver.php', {iddriver:driver.iddriver});
|
return $http.post('server/deletedriver.php', {
|
||||||
|
iddriver: driver.iddriver
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
appServices.service('DriveService', function($http) {
|
appServices.service('DriveService', function($http) {
|
||||||
this.getComments = function(idrace, drivenr) {
|
this.getComments = function(idrace, drivenr) {
|
||||||
console.log('getting comments for: '+idrace+' '+drivenr);
|
console.log('getting comments for: ' + idrace + ' ' + drivenr);
|
||||||
return $http.post('server/getcomments.php', {idrace:idrace, drivenr:drivenr});
|
return $http.post('server/getcomments.php', {
|
||||||
|
idrace: idrace,
|
||||||
|
drivenr: drivenr
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addComment = function(idrace, drivenr, comment, penaltyseconds) {
|
this.addComment = function(idrace, drivenr, comment, penaltyseconds) {
|
||||||
return $http.post('server/addcomment.php', {idrace:idrace, drivenr:drivenr, comment:comment, penaltyseconds:penaltyseconds});
|
return $http.post('server/addcomment.php', {
|
||||||
|
idrace: idrace,
|
||||||
|
drivenr: drivenr,
|
||||||
|
comment: comment,
|
||||||
|
penaltyseconds: penaltyseconds
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteComment = function(idcomment) {
|
this.deleteComment = function(idcomment) {
|
||||||
return $http.post('server/deletecomment.php', {idcomment:idcomment});
|
return $http.post('server/deletecomment.php', {
|
||||||
|
idcomment: idcomment
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteDriver = function(driver) {
|
this.deleteDriver = function(driver) {
|
||||||
console.log('removing driver');
|
console.log('removing driver');
|
||||||
return $http.post('server/deletedriver.php', {iddriver:driver.iddriver});
|
return $http.post('server/deletedriver.php', {
|
||||||
|
iddriver: driver.iddriver
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
appServices.service('OverviewService', function($http) {
|
appServices.service('OverviewService', function($http) {
|
||||||
this.getData = function(idchampionship) {
|
this.getData = function(idchampionship) {
|
||||||
return $http.post('server/getoverviewofchampionship.php', {idchampionship:idchampionship});
|
return $http.post('server/getoverviewofchampionship.php', {
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
appServices.service('ViewerService', function($http) {
|
appServices.service('ViewerService', function($http) {
|
||||||
this.getTeamsForPoule = function(idchampionship, tier, poule) {
|
this.getTeamsForPoule = function(idchampionship, tier, poule) {
|
||||||
return $http.post('server/getteamsforpoule.php', {tier:tier, poule:poule, idchampionship:idchampionship});
|
return $http.post('server/getteamsforpoule.php', {
|
||||||
|
tier: tier,
|
||||||
|
poule: poule,
|
||||||
|
idchampionship: idchampionship
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -176,17 +283,19 @@ appServices.service('MainService', function($http, $cookies) {
|
|||||||
var activerace = null;
|
var activerace = null;
|
||||||
|
|
||||||
this.refreshConfig = function() {
|
this.refreshConfig = function() {
|
||||||
$http.post('server/config.php', {action:'getConfig'}).
|
$http.post('server/config.php', {
|
||||||
|
action: 'getConfig'
|
||||||
|
}).
|
||||||
success(function(data, status, headers, config) {
|
success(function(data, status, headers, config) {
|
||||||
// console.log('refreshConfig successful...');
|
// console.log('refreshConfig successful...');
|
||||||
//refresh activerace
|
//refresh activerace
|
||||||
if(data.activeidrace != null) {
|
if (data.activeidrace != null) {
|
||||||
// console.log('setting the activerace...');
|
// console.log('setting the activerace...');
|
||||||
activerace = {
|
activerace = {
|
||||||
idrace:data.activeidrace,
|
idrace: data.activeidrace,
|
||||||
tier:data.tier,
|
tier: data.tier,
|
||||||
poule:data.poule,
|
poule: data.poule,
|
||||||
idchampionship:data.idchampionship
|
idchampionship: data.idchampionship
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// console.log('idrace was null, setting activerace to null');
|
// console.log('idrace was null, setting activerace to null');
|
||||||
@ -200,17 +309,20 @@ appServices.service('MainService', function($http, $cookies) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.setActiveRace = function(idrace, tier, poule, idchampionship) {
|
this.setActiveRace = function(idrace, tier, poule, idchampionship) {
|
||||||
if(idrace == null) {
|
if (idrace == null) {
|
||||||
activerace = null;
|
activerace = null;
|
||||||
} else {
|
} else {
|
||||||
activerace = {
|
activerace = {
|
||||||
idrace:idrace,
|
idrace: idrace,
|
||||||
tier:tier,
|
tier: tier,
|
||||||
poule:poule,
|
poule: poule,
|
||||||
idchampionship:idchampionship
|
idchampionship: idchampionship
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
$http.post('server/config.php', {action:'setActiveIdRace', idrace:idrace}).
|
$http.post('server/config.php', {
|
||||||
|
action: 'setActiveIdRace',
|
||||||
|
idrace: idrace
|
||||||
|
}).
|
||||||
success(function(data, status, headers, config) {
|
success(function(data, status, headers, config) {
|
||||||
//do something?
|
//do something?
|
||||||
});
|
});
|
||||||
@ -221,9 +333,9 @@ appServices.service('MainService', function($http, $cookies) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.toggleActiveRace = function(idrace, tier, poule, idchampionship) {
|
this.toggleActiveRace = function(idrace, tier, poule, idchampionship) {
|
||||||
console.log('toggling active race'+idrace);
|
console.log('toggling active race' + idrace);
|
||||||
//if the race is not the same as the currently active on: switch it
|
//if the race is not the same as the currently active on: switch it
|
||||||
if(activerace == null || activerace.idrace!=idrace) {
|
if (activerace == null || activerace.idrace != idrace) {
|
||||||
this.setActiveRace(idrace, tier, poule, idchampionship);
|
this.setActiveRace(idrace, tier, poule, idchampionship);
|
||||||
} else {
|
} else {
|
||||||
//well, it's the same: we're disabling the activeness of the race
|
//well, it's the same: we're disabling the activeness of the race
|
||||||
|
|||||||
@ -11,15 +11,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form class="form-inline">
|
<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>
|
<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>
|
||||||
<div class="form-group form-group-sm">
|
<div class="form-group form-group-sm" style="display:inline-block">
|
||||||
<label for="pouleInput">Poule</label>
|
<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>
|
</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>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<span class="input-group-addon" id="sizing-addon2">Naam</span>
|
<span class="input-group-addon" id="sizing-addon2">Naam</span>
|
||||||
<input type="text" class="form-control" aria-describedby="sizing-addon2" ng-model="newchampionship.name">
|
<input type="text" class="form-control" aria-describedby="sizing-addon2" ng-model="newchampionship.name">
|
||||||
<span class="input-group-btn">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -5,28 +5,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- every team gets a column -->
|
<div class="col-sm-12">
|
||||||
<div class="col-xs-2" ng-repeat="team in teamsInPoule">
|
<div class="team-col pull-left" ng-repeat="team in teamsInPoule" ng-style="{'width':(100/teamsInPoule.length)+'%'}">
|
||||||
<div class="row">
|
|
||||||
<h2>{{team.teamname}}</h2>
|
<h2>{{team.teamname}}</h2>
|
||||||
</div>
|
<div ng-repeat="race in team.races">
|
||||||
<!-- and that column is filled with rows: each row is a laptime -->
|
|
||||||
<div class="row" ng-repeat="race in team.races">
|
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">Race {{race.idrace}}</h3>
|
<h3 class="panel-title">Race {{race.idrace}}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
<div ng-repeat="laptime in race.laptimes">{{laptime.laptime | interval}}</div>
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -15,14 +15,14 @@
|
|||||||
|
|
||||||
//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";
|
// $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";
|
// $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";
|
// $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";
|
// $result['lasterror'].=pg_last_error()."\n";
|
||||||
|
|
||||||
//resulting teams array
|
//resulting teams array
|
||||||
$teams = array();
|
$teams = array();
|
||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
//loop over each race
|
//loop over each race
|
||||||
$racefetchexec = pg_execute($dbconn, "racefetch", array($tier, $poule, $idchampionship, $idteam));
|
$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)) {
|
while($racerow = pg_fetch_assoc($racefetchexec)) {
|
||||||
$result['GETTING IN IT'] = true;
|
$result['GETTING IN IT'] = true;
|
||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
//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";
|
// $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'];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user