only last 10 performances

This commit is contained in:
Julien Calixte
2025-08-09 17:46:40 +02:00
parent 46a5a9e588
commit a9b6ce17f1

View File

@@ -2,12 +2,16 @@
import { useBoardGameStore } from '@/modules/5s/board-game-store' import { useBoardGameStore } from '@/modules/5s/board-game-store'
import { toDuration, toSeconds } from '@/modules/5s/utils' import { toDuration, toSeconds } from '@/modules/5s/utils'
import { getNatural } from '@/utils' import { getNatural } from '@/utils'
import { ref } from 'vue' import { computed, ref } from 'vue'
const boardGameStore = useBoardGameStore() const boardGameStore = useBoardGameStore()
const duration = ref<string | null>(null) const duration = ref<string | null>(null)
const last10Perfs = computed(() =>
[...boardGameStore.meta.perfs].slice(-10).reverse()
)
setInterval(() => { setInterval(() => {
duration.value = boardGameStore.meta.start duration.value = boardGameStore.meta.start
? toDuration( ? toDuration(
@@ -28,15 +32,13 @@ setInterval(() => {
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Round</th>
<th>Duration</th> <th>Duration</th>
<th>Board Games</th> <th>Board Games</th>
<th>Time / board game</th> <th>Time / board game</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(perf, index) in boardGameStore.meta.perfs"> <tr v-for="perf in last10Perfs">
<td>{{ index + 1 }}</td>
<td class="numeric"> <td class="numeric">
{{ toDuration(new Date(perf.start), new Date(perf.end)) }} {{ toDuration(new Date(perf.start), new Date(perf.end)) }}
</td> </td>
@@ -54,7 +56,6 @@ setInterval(() => {
</tr> </tr>
</tbody> </tbody>
</table> </table>
{{ boardGameStore.countUsedTools }}
</template> </template>
</div> </div>
</template> </template>