parent
3275ae2609
commit
10b862d43a
@ -6,7 +6,7 @@
|
|||||||
function init(el) {
|
function init(el) {
|
||||||
el.focus();
|
el.focus();
|
||||||
}
|
}
|
||||||
$: pages = ["general", "runners_distance", "orgs_distance", "teams_distance"];
|
$: pages = ["general", "runners_distance","runners_laptime", "orgs_distance", "teams_distance"];
|
||||||
$: current_page = "general";
|
$: current_page = "general";
|
||||||
$: general = {};
|
$: general = {};
|
||||||
$: runners = [];
|
$: runners = [];
|
||||||
@ -17,10 +17,22 @@
|
|||||||
$: hours = (time.getHours() + "").padStart(2, "0");
|
$: hours = (time.getHours() + "").padStart(2, "0");
|
||||||
$: minutes = (time.getMinutes() + "").padStart(2, "0");
|
$: minutes = (time.getMinutes() + "").padStart(2, "0");
|
||||||
$: seconds = (time.getSeconds() + "").padStart(2, "0");
|
$: seconds = (time.getSeconds() + "").padStart(2, "0");
|
||||||
function format_laptime(laptime){
|
function format_laptime(laptime) {
|
||||||
if(laptime < 60){return `${laptime}s`}
|
if (laptime < 60) {
|
||||||
if(laptime < 3600){return `${Math.floor(laptime / 60)}min ${laptime - (Math.floor(laptime / 60)*60)}s`}
|
return `${laptime}s`;
|
||||||
return `${Math.floor(laptime / 3600)}h ${laptime - (Math.floor(laptime / 3600)*3600)}min ${laptime - (Math.floor(laptime / 3600)*3600) - (Math.floor(laptime / 60)*60)}`
|
}
|
||||||
|
if (laptime < 3600) {
|
||||||
|
return `${Math.floor(laptime / 60)}min ${
|
||||||
|
laptime - Math.floor(laptime / 60) * 60
|
||||||
|
}s`;
|
||||||
|
}
|
||||||
|
return `${Math.floor(laptime / 3600)}h ${
|
||||||
|
laptime - Math.floor(laptime / 3600) * 3600
|
||||||
|
}min ${
|
||||||
|
laptime -
|
||||||
|
Math.floor(laptime / 3600) * 3600 -
|
||||||
|
Math.floor(laptime / 60) * 60
|
||||||
|
}`;
|
||||||
}
|
}
|
||||||
function stats_general() {
|
function stats_general() {
|
||||||
axios
|
axios
|
||||||
@ -50,6 +62,20 @@
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function stats_runners_by_laptime() {
|
||||||
|
axios
|
||||||
|
.request({
|
||||||
|
method: "GET",
|
||||||
|
url: $api_endpoint + "api/stats/runners/laptime",
|
||||||
|
headers: { Authorization: "Bearer " + $apikey },
|
||||||
|
})
|
||||||
|
.then(function ({ data }) {
|
||||||
|
runners_by_laptime = data;
|
||||||
|
})
|
||||||
|
.catch(function (e) {
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
function stats_orgs() {
|
function stats_orgs() {
|
||||||
axios
|
axios
|
||||||
.request({
|
.request({
|
||||||
@ -86,6 +112,7 @@
|
|||||||
function fetch_all() {
|
function fetch_all() {
|
||||||
stats_general();
|
stats_general();
|
||||||
stats_runners();
|
stats_runners();
|
||||||
|
stats_runners_by_laptime();
|
||||||
stats_orgs();
|
stats_orgs();
|
||||||
stats_teams();
|
stats_teams();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user