ALPR Stats (#2)

* set up lambda to get total ALPR counts

* show total counts on map, updated hourly
This commit is contained in:
Will Freeman
2024-11-20 14:49:19 -06:00
committed by GitHub
parent 6bb2c1ea99
commit 0d062296a3
9 changed files with 215 additions and 175 deletions
+44
View File
@@ -0,0 +1,44 @@
<template>
<v-card>
<v-card-text class="text-center">
<div class="d-flex flex-row justify-space-between">
<div class="px-2">
<h6>US</h6>
<h4>{{ formatCount(counts.us) }}</h4>
</div>
<v-divider vertical></v-divider>
<div class="px-2">
<h6>Worldwide</h6>
<h4>{{ formatCount(counts.worldwide) }}</h4>
</div>
</div>
</v-card-text>
</v-card>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { getALPRCounts } from '@/services/apiService';
const counts = ref({
us: null,
worldwide: null,
});
onMounted(() => {
getALPRCounts().then((response) => {
counts.value = response;
});
});
function formatCount(count: number | null): string {
if (count === null) {
return '-';
}
if (count < 1000) {
return Math.round(count / 10) * 10 + '';
}
const rounded = Math.round(count / 100) / 10;
return `${rounded}k+`;
}
</script>