Refine admin panel workflows
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import type { AdminMetric } from '../types/awards'
|
||||
|
||||
export function getMetricValue(metrics: AdminMetric[], labels: string[]) {
|
||||
const normalizedLabels = labels.map((label) => label.toLowerCase())
|
||||
return metrics.find((metric) => normalizedLabels.includes(metric.label.toLowerCase()))?.value ?? 0
|
||||
}
|
||||
|
||||
export function getVoteMetricValue(metrics: AdminMetric[]) {
|
||||
return getMetricValue(metrics, ['Stimmen', 'Votes'])
|
||||
}
|
||||
Reference in New Issue
Block a user