mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Dodano brakujące tłumaczenia
This commit is contained in:
@@ -32,6 +32,16 @@ const confirmedPercentage = (stops: TrainStop[] | undefined) => {
|
||||
return Number(((stops.filter((stop) => stop.confirmed).length / stops.length) * 100).toFixed(0));
|
||||
};
|
||||
|
||||
const currentDelay = (stops: TrainStop[] | undefined) => {
|
||||
if (!stops) return -Infinity;
|
||||
|
||||
const delay =
|
||||
stops.find((stop, i) => (i == 0 && !stop.confirmed) || (i > 0 && stops[i - 1].confirmed && !stop.confirmed))
|
||||
?.departureDelay || 0;
|
||||
|
||||
return delay;
|
||||
};
|
||||
|
||||
const filteredTrainList = (
|
||||
trainList: Train[],
|
||||
searchedTrain: string,
|
||||
@@ -63,6 +73,12 @@ const filteredTrainList = (
|
||||
|
||||
return -sorterActive.dir;
|
||||
|
||||
case 'delay':
|
||||
if (currentDelay(a.timetableData?.followingStops) > currentDelay(b.timetableData?.followingStops))
|
||||
return sorterActive.dir;
|
||||
|
||||
return -sorterActive.dir;
|
||||
|
||||
case 'speed':
|
||||
if (a.speed > b.speed) return sorterActive.dir;
|
||||
return -sorterActive.dir;
|
||||
|
||||
Reference in New Issue
Block a user