mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 05:48: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(() => {
|
const timetableStats = computed(() => {
|
||||||
if (props.trains.length == 0) return { avg: "0", min: "0", max: "0" };
|
if (props.trains.length == 0) return { avg: "0", min: "0", max: "0" };
|
||||||
|
|
||||||
|
const activeTrainsLength = props.trains.filter(
|
||||||
|
(train) => train.timetableData
|
||||||
|
).length;
|
||||||
|
|
||||||
const avg = (
|
const avg = (
|
||||||
props.trains.reduce(
|
props.trains.reduce(
|
||||||
(acc, train) =>
|
(acc, train) =>
|
||||||
train.timetableData ? acc + train.timetableData.routeDistance : acc,
|
train.timetableData ? acc + train.timetableData.routeDistance : acc,
|
||||||
0
|
0
|
||||||
) / props.trains.length
|
) / activeTrainsLength
|
||||||
).toFixed(2);
|
).toFixed(2);
|
||||||
|
|
||||||
const minMaxDistance = props.trains.reduce((acc, train) => {
|
const minMaxDistance = props.trains.reduce((acc, train) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user