mirror of
https://github.com/allan-cff/strava-free-year-in-sport.git
synced 2026-01-18 16:47:35 +01:00
average heartrate
This commit is contained in:
@@ -208,6 +208,11 @@ function getTotals(storedAs = 'activities', storeAs = 'totals'){
|
||||
kudos : 0,
|
||||
count : 0
|
||||
},
|
||||
heartrate : {
|
||||
total : 0,
|
||||
count : 0,
|
||||
max : 0
|
||||
},
|
||||
ride : {
|
||||
climb : 0,
|
||||
distance : 0,
|
||||
@@ -248,6 +253,11 @@ function getTotals(storedAs = 'activities', storeAs = 'totals'){
|
||||
totals.total.pr += activity.pr_count;
|
||||
totals.total.kudos += activity.kudos_count;
|
||||
totals.total.count += 1;
|
||||
if("average_heartrate" in activity){
|
||||
totals.heartrate.count += 1;
|
||||
totals.heartrate.total += activity.average_heartrate;
|
||||
totals.heartrate.max = Math.max(totals.heartrate.max, activity.average_heartrate);
|
||||
}
|
||||
switch(activity.type){
|
||||
case 'Ride' :
|
||||
totals.ride.climb += activity.total_elevation_gain;
|
||||
|
||||
@@ -26,9 +26,13 @@ function numberAnimation(selector, value, duration = 3){
|
||||
|
||||
console.log(getPRNumber());
|
||||
console.log(getKudosNumber());
|
||||
const totals = getTotals()
|
||||
|
||||
numberAnimation('.record .medaille .nombre-sm', getPRNumber());
|
||||
document.querySelector("#kudos .nombre-md").innerHTML = getTotals().total.kudos;
|
||||
document.querySelector("#kudos .nombre-md").innerHTML = totals.total.kudos;
|
||||
const mostKudoed = JSON.parse(localStorage.getItem('activities')).find(a => a.id === parseInt(localStorage.getItem('most-kudoed'), 10));
|
||||
document.querySelector("#kudos #most-kudoed .nombre-md").innerHTML = mostKudoed.kudos_count;
|
||||
document.querySelector("#kudos #most-kudoed .texte-kudos").innerHTML = mostKudoed.name;
|
||||
document.querySelector("#kudos #most-kudoed .texte-kudos").innerHTML = mostKudoed.name;
|
||||
if(totals.heartrate.count > 0){
|
||||
document.querySelector("#fc .nombre-sm").innerHTML = (totals.heartrate.total / totals.heartrate.count).toFixed(1);
|
||||
}
|
||||
Reference in New Issue
Block a user