diff --git a/index.html b/index.html index f179928..217cca6 100644 --- a/index.html +++ b/index.html @@ -133,6 +133,7 @@

<fitness-card date="item.date" + replayable="true" steps="item.steps" distance="item.distance" flights="item.flights" move-total="item.move.total" move-goal="item.move.goal" exercise-total="item.exercise.total" exercise-goal="item.exercise.goal" diff --git a/js/FitnessCard.js b/js/FitnessCard.js index 5f1ba09..ae6ac93 100644 --- a/js/FitnessCard.js +++ b/js/FitnessCard.js @@ -348,6 +348,7 @@ export default class FitnessCard extends HTMLElement { { - if (wrapper.classList.contains('complete')) { + if (this.replayable() && wrapper.classList.contains('complete')) { wrapper.classList.add('reset'); wrapper.classList.remove('complete'); } @@ -67,6 +67,8 @@ export default class FitnessRing extends HTMLElement { this.observer.disconnect(); } + replayable =() => this.getAttribute('replayable') && this.getAttribute('replayable') === 'true'; + percentage = (total = 0, goal = 100, max = 100) => Math.min(Math.floor((total / goal) * 100), max);