added distance formatting

ref #39
This commit is contained in:
Philipp Dormann 2021-04-06 21:23:24 +02:00
parent d713fbef94
commit 121022c843
1 changed files with 2 additions and 1 deletions

View File

@ -216,7 +216,7 @@
<tbody class="text-gray-900 dark:text-gray-50">
<tr v-for="s in state.scans" :key="s.id">
<td class="px-4 py-3">
<span v-text="s.distance"></span>m
<span v-text="s.distance"></span>
</td>
<td class="px-4 py-3" v-text="s.lapTime"></td>
</tr>
@ -342,6 +342,7 @@ axios.get(`${config.baseurl}api/runners/me/${accesstoken}/scans`)
.then(({ data }) => {
data.map(function(s) {
s.lapTime = Math.floor(s.lapTime / 60) + 'min ' + (Math.floor(s.lapTime % 60) + "").padStart(2, "0") + "s"
s.distance = Math.floor(s.distance / 1000) + 'km ' + (Math.floor(s.distance % 1000) + "").padStart(3, "0") + "m"
return s;
})
data.filter(s => s.valid === true);