filtry pociągów

This commit is contained in:
2023-03-15 17:56:27 +01:00
parent 0a78761928
commit e4c5f6a322
8 changed files with 27 additions and 15 deletions
+2
View File
@@ -11,6 +11,8 @@ export const enum TrainFilterType {
twr = 'twr',
skr = 'skr',
common = 'common',
passenger = 'passenger',
freight = 'freight',
other = 'other',
+9 -6
View File
@@ -31,17 +31,20 @@ function filterTrainList(trainList: Train[], searchedTrain: string, searchedDriv
case TrainFilterType.withTimetable:
return !train.timetableData;
case TrainFilterType.noComments:
return train.timetableData?.followingStops.some((stop) => stop.comments) || false;
case TrainFilterType.withComments:
return train.timetableData?.followingStops.every((stop) => stop.comments) || true;
return !train.timetableData?.followingStops.some((stop) => stop.comments);
case TrainFilterType.noComments:
return train.timetableData?.followingStops.some((stop) => stop.comments);
case TrainFilterType.twr:
return !train.timetableData?.TWR || true;
return !train.timetableData?.TWR;
case TrainFilterType.skr:
return !train.timetableData?.SKR || true;
return !train.timetableData?.SKR;
case TrainFilterType.common:
return train.timetableData?.SKR || train.timetableData?.TWR;
case TrainFilterType.passenger:
return !/^[AMRE]\D{2}$/.test(train.timetableData?.category || '');