mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Hotfix: średnia długość rozkładów
This commit is contained in:
@@ -138,12 +138,16 @@ export default defineComponent({
|
||||
const timetableStats = computed(() => {
|
||||
if (props.trains.length == 0) return { avg: "0", min: "0", max: "0" };
|
||||
|
||||
const activeTrainsLength = props.trains.filter(
|
||||
(train) => train.timetableData
|
||||
).length;
|
||||
|
||||
const avg = (
|
||||
props.trains.reduce(
|
||||
(acc, train) =>
|
||||
train.timetableData ? acc + train.timetableData.routeDistance : acc,
|
||||
0
|
||||
) / props.trains.length
|
||||
) / activeTrainsLength
|
||||
).toFixed(2);
|
||||
|
||||
const minMaxDistance = props.trains.reduce((acc, train) => {
|
||||
|
||||
Reference in New Issue
Block a user