mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-05 22:38:11 +00:00
checkpointy; hotfixy
This commit is contained in:
@@ -101,7 +101,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
onlineDispatchersCount() {
|
onlineDispatchersCount() {
|
||||||
return this.store.activeSceneryList.filter(
|
return this.store.activeSceneryList.filter(
|
||||||
(scenery) => scenery.region == this.store.region.id
|
(scenery) => scenery.region == this.store.region.id && scenery.dispatcherId != -1
|
||||||
).length;
|
).length;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
{{ (i > 0 && '•') || '' }}
|
{{ (i > 0 && '•') || '' }}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
:key="cp.checkpointName"
|
:key="cp"
|
||||||
class="checkpoint_item"
|
class="checkpoint_item"
|
||||||
:class="{ current: chosenCheckpoint === cp.checkpointName }"
|
:class="{ current: chosenCheckpoint === cp }"
|
||||||
@click="setCheckpoint(cp)"
|
@click="setCheckpoint(cp)"
|
||||||
>
|
>
|
||||||
{{ cp.checkpointName }}
|
{{ cp }}
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -231,7 +231,7 @@ export default defineComponent({
|
|||||||
const chosenCheckpoint = ref(
|
const chosenCheckpoint = ref(
|
||||||
props.station?.generalInfo?.checkpoints?.length == 0
|
props.station?.generalInfo?.checkpoints?.length == 0
|
||||||
? ''
|
? ''
|
||||||
: props.station?.generalInfo?.checkpoints[0].checkpointName || null
|
: props.station?.generalInfo?.checkpoints[0] ?? null
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -278,12 +278,11 @@ export default defineComponent({
|
|||||||
loadSelectedOption() {
|
loadSelectedOption() {
|
||||||
if (!this.station) return;
|
if (!this.station) return;
|
||||||
|
|
||||||
this.chosenCheckpoint =
|
this.chosenCheckpoint = this.station.generalInfo?.checkpoints[0] ?? this.station.name;
|
||||||
this.station.generalInfo?.checkpoints[0]?.checkpointName || this.station.name;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setCheckpoint(cp: { checkpointName: string }) {
|
setCheckpoint(cp: string) {
|
||||||
this.chosenCheckpoint = cp.checkpointName;
|
this.chosenCheckpoint = cp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -42,14 +42,13 @@ export interface Filter {
|
|||||||
nonPublic: boolean;
|
nonPublic: boolean;
|
||||||
unavailable: boolean;
|
unavailable: boolean;
|
||||||
abandoned: boolean;
|
abandoned: boolean;
|
||||||
|
|
||||||
endingStatus: boolean;
|
endingStatus: boolean;
|
||||||
afkStatus: boolean;
|
afkStatus: boolean;
|
||||||
noSpaceStatus: boolean;
|
noSpaceStatus: boolean;
|
||||||
unavailableStatus: boolean;
|
unavailableStatus: boolean;
|
||||||
unsignedStatus: boolean;
|
unsignedStatus: boolean;
|
||||||
|
|
||||||
authors: string;
|
authors: string;
|
||||||
|
|
||||||
onlineFromHours: number;
|
onlineFromHours: number;
|
||||||
|
withActiveTimetables: boolean;
|
||||||
|
withoutActiveTimetables: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-1
@@ -7,7 +7,8 @@
|
|||||||
"addons",
|
"addons",
|
||||||
"blockades",
|
"blockades",
|
||||||
"signals",
|
"signals",
|
||||||
"status"
|
"status",
|
||||||
|
"timetables"
|
||||||
],
|
],
|
||||||
|
|
||||||
"options": [
|
"options": [
|
||||||
@@ -228,6 +229,20 @@
|
|||||||
"section": "status",
|
"section": "status",
|
||||||
"value": true,
|
"value": true,
|
||||||
"defaultValue": true
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "withActiveTimetables",
|
||||||
|
"name": "withActiveTimetables",
|
||||||
|
"section": "timetables",
|
||||||
|
"value": true,
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "withoutActiveTimetables",
|
||||||
|
"name": "withoutActiveTimetables",
|
||||||
|
"section": "timetables",
|
||||||
|
"value": true,
|
||||||
|
"defaultValue": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sliders": [
|
"sliders": [
|
||||||
|
|||||||
+5
-1
@@ -165,7 +165,8 @@
|
|||||||
"signals": "TYP SYGNALIZACJI",
|
"signals": "TYP SYGNALIZACJI",
|
||||||
"addons": "DODATKOWE PROGRAMY",
|
"addons": "DODATKOWE PROGRAMY",
|
||||||
"blockades": "BLOKADY LINIOWE",
|
"blockades": "BLOKADY LINIOWE",
|
||||||
"status": "STATUS ONLINE"
|
"status": "STATUS ONLINE",
|
||||||
|
"timetables": "AKTYWNE ROZKŁADY JAZDY"
|
||||||
},
|
},
|
||||||
|
|
||||||
"all-available": "WSZYSTKIE DOSTĘPNE",
|
"all-available": "WSZYSTKIE DOSTĘPNE",
|
||||||
@@ -209,6 +210,9 @@
|
|||||||
"free": "WOLNA",
|
"free": "WOLNA",
|
||||||
"occupied": "ZAJĘTA",
|
"occupied": "ZAJĘTA",
|
||||||
|
|
||||||
|
"withActiveTimetables": "AKTYWNE RJ",
|
||||||
|
"withoutActiveTimetables": "BEZ AKTYWNYCH RJ",
|
||||||
|
|
||||||
"sliders": {
|
"sliders": {
|
||||||
"min-lvl": "MIN. WYMAGANY POZIOM DYŻURNEGO",
|
"min-lvl": "MIN. WYMAGANY POZIOM DYŻURNEGO",
|
||||||
"max-lvl": "MAKS. WYMAGANY POZIOM DYŻURNEGO",
|
"max-lvl": "MAKS. WYMAGANY POZIOM DYŻURNEGO",
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ export default interface Station {
|
|||||||
availability: Availability;
|
availability: Availability;
|
||||||
routes: StationRoutes;
|
routes: StationRoutes;
|
||||||
|
|
||||||
checkpoints: {
|
checkpoints: string[];
|
||||||
checkpointName: string;
|
|
||||||
scheduledTrains: ScheduledTrain[];
|
|
||||||
}[];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onlineInfo?: ActiveScenery;
|
onlineInfo?: ActiveScenery;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export const sortStations = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const filterStations = (station: Station, filters: Filter) => {
|
export const filterStations = (station: Station, filters: Filter) => {
|
||||||
if (!station.onlineInfo && filters['free']) return false;
|
if (filters['free'] && !station.onlineInfo) return false;
|
||||||
|
|
||||||
if (station.onlineInfo) {
|
if (station.onlineInfo) {
|
||||||
const { dispatcherStatus } = station.onlineInfo;
|
const { dispatcherStatus } = station.onlineInfo;
|
||||||
@@ -112,7 +112,10 @@ export const filterStations = (station: Station, filters: Filter) => {
|
|||||||
|
|
||||||
const isOccupied = station.onlineInfo && filters['occupied'];
|
const isOccupied = station.onlineInfo && filters['occupied'];
|
||||||
|
|
||||||
if (isEnding || isNotSigned || isAFK || isNoSpace || isOccupied) return false;
|
const isActiveFree =
|
||||||
|
dispatcherStatus == Status.ActiveDispatcher.FREE && filters['withActiveTimetables'];
|
||||||
|
|
||||||
|
if (isEnding || isNotSigned || isAFK || isNoSpace || isOccupied || isActiveFree) return false;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
filters['onlineFromHours'] > 0 &&
|
filters['onlineFromHours'] > 0 &&
|
||||||
|
|||||||
+14
-21
@@ -166,31 +166,28 @@ export const useMainStore = defineStore('store', {
|
|||||||
dispatcherId: scenery.dispatcherId,
|
dispatcherId: scenery.dispatcherId,
|
||||||
dispatcherExp: scenery.dispatcherExp,
|
dispatcherExp: scenery.dispatcherExp,
|
||||||
dispatcherIsSupporter: scenery.dispatcherIsSupporter,
|
dispatcherIsSupporter: scenery.dispatcherIsSupporter,
|
||||||
|
dispatcherStatus: scenery.dispatcherStatus,
|
||||||
|
dispatcherTimestamp: dispatcherTimestamp,
|
||||||
|
|
||||||
|
isOnline: scenery.isOnline == 1,
|
||||||
|
|
||||||
scheduledTrains: [],
|
scheduledTrains: [],
|
||||||
stationTrains: [],
|
stationTrains: [],
|
||||||
scheduledTrainCount: {
|
scheduledTrainCount: {
|
||||||
all: 0,
|
all: 0,
|
||||||
confirmed: 0,
|
confirmed: 0,
|
||||||
unconfirmed: 0
|
unconfirmed: 0
|
||||||
},
|
}
|
||||||
// scheduledTrains: scheduledTrains,
|
|
||||||
// stationTrains: stationTrains,
|
|
||||||
dispatcherStatus: scenery.dispatcherStatus,
|
|
||||||
dispatcherTimestamp: dispatcherTimestamp,
|
|
||||||
|
|
||||||
isOnline: scenery.isOnline == 1
|
|
||||||
|
|
||||||
// scheduledTrainCount: {
|
|
||||||
// all: uniqueScheduledTrains.length,
|
|
||||||
// confirmed: uniqueScheduledTrains.filter((train) => train.stopInfo.confirmed).length,
|
|
||||||
// unconfirmed: uniqueScheduledTrains.filter((train) => !train.stopInfo.confirmed).length
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}, [] as ActiveScenery[]);
|
}, [] as ActiveScenery[]);
|
||||||
|
|
||||||
[...onlineActiveSceneries, ...offlineActiveSceneries].forEach((scenery) => {
|
const allActiveSceneries = [...onlineActiveSceneries, ...offlineActiveSceneries];
|
||||||
|
|
||||||
|
for (let i = 0, n = allActiveSceneries.length; i < n; i++) {
|
||||||
|
const scenery = allActiveSceneries[i];
|
||||||
|
|
||||||
const station = this.stationList.find((s) => s.name === scenery.name);
|
const station = this.stationList.find((s) => s.name === scenery.name);
|
||||||
|
|
||||||
const scheduledTrains = getScheduledTrains(
|
const scheduledTrains = getScheduledTrains(
|
||||||
@@ -224,11 +221,11 @@ export const useMainStore = defineStore('store', {
|
|||||||
confirmed: uniqueScheduledTrains.filter((train) => train.stopInfo.confirmed).length,
|
confirmed: uniqueScheduledTrains.filter((train) => train.stopInfo.confirmed).length,
|
||||||
unconfirmed: uniqueScheduledTrains.filter((train) => !train.stopInfo.confirmed).length
|
unconfirmed: uniqueScheduledTrains.filter((train) => !train.stopInfo.confirmed).length
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
|
|
||||||
console.timeEnd('d');
|
console.timeEnd('d');
|
||||||
|
|
||||||
return [...onlineActiveSceneries, ...offlineActiveSceneries];
|
return allActiveSceneries;
|
||||||
},
|
},
|
||||||
|
|
||||||
stationList(): Station[] {
|
stationList(): Station[] {
|
||||||
@@ -268,11 +265,7 @@ export const useMainStore = defineStore('store', {
|
|||||||
...scenery,
|
...scenery,
|
||||||
authors: scenery.authors?.split(',').map((a) => a.trim()),
|
authors: scenery.authors?.split(',').map((a) => a.trim()),
|
||||||
routes: routes,
|
routes: routes,
|
||||||
checkpoints: scenery.checkpoints
|
checkpoints: scenery.checkpoints?.split(';') ?? []
|
||||||
? scenery.checkpoints
|
|
||||||
.split(';')
|
|
||||||
.map((sub) => ({ checkpointName: sub, scheduledTrains: [] }))
|
|
||||||
: []
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ const filterInitStates: Filter = {
|
|||||||
noSpaceStatus: false,
|
noSpaceStatus: false,
|
||||||
unavailableStatus: false,
|
unavailableStatus: false,
|
||||||
unsignedStatus: false,
|
unsignedStatus: false,
|
||||||
|
withActiveTimetables: false,
|
||||||
|
withoutActiveTimetables: false,
|
||||||
|
|
||||||
authors: '',
|
authors: '',
|
||||||
|
|
||||||
|
|||||||
+30
-61
@@ -102,51 +102,33 @@ export function getCheckpointTrain(
|
|||||||
let prevStationName = '',
|
let prevStationName = '',
|
||||||
nextStationName = '';
|
nextStationName = '';
|
||||||
|
|
||||||
let prevDepartureLine: string | null = null,
|
|
||||||
nextArrivalLine: string | null = null;
|
|
||||||
|
|
||||||
for (let i = trainStopIndex - 1; i >= 0; i--) {
|
|
||||||
if (/strong|podg/g.test(followingStops[i].stopName)) {
|
|
||||||
prevStationName = followingStops[i].stopNameRAW.replace(/,.*/g, '');
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = trainStopIndex + 1; i < followingStops.length; i++) {
|
|
||||||
if (/strong|podg/g.test(followingStops[i].stopName)) {
|
|
||||||
nextStationName = followingStops[i].stopNameRAW.replace(/,.*/g, '');
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let departureLine: string | null = null;
|
let departureLine: string | null = null;
|
||||||
let arrivingLine: string | null = null;
|
let arrivingLine: string | null = null;
|
||||||
|
|
||||||
for (let i = trainStopIndex; i < followingStops.length; i++) {
|
let prevDepartureLine: string | null = null,
|
||||||
const currentStop = followingStops[i];
|
nextArrivalLine: string | null = null;
|
||||||
|
|
||||||
if (currentStop.departureLine == null) continue;
|
|
||||||
|
|
||||||
if (!/-|_|it|sbl/gi.test(currentStop.departureLine)) {
|
|
||||||
departureLine = currentStop.departureLine;
|
|
||||||
nextArrivalLine = followingStops[i + 1]?.arrivalLine || null;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = trainStopIndex; i >= 0; i--) {
|
for (let i = trainStopIndex; i >= 0; i--) {
|
||||||
const currentStop = followingStops[i];
|
const stop = followingStops[i];
|
||||||
|
|
||||||
if (currentStop.arrivalLine == null) continue;
|
if (/strong|podg/g.test(stop.stopName) && !prevStationName && i <= trainStopIndex - 1)
|
||||||
|
prevStationName = stop.stopNameRAW.replace(/,.*/g, '');
|
||||||
|
|
||||||
if (!/-|_|it|sbl/gi.test(currentStop.arrivalLine)) {
|
if (stop.arrivalLine != null && !arrivingLine && !/-|_|it|sbl/gi.test(stop.arrivalLine)) {
|
||||||
arrivingLine = currentStop.arrivalLine;
|
arrivingLine = stop.arrivalLine;
|
||||||
prevDepartureLine = followingStops[i - 1]?.departureLine || null;
|
prevDepartureLine = followingStops[i - 1]?.departureLine || null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
for (let i = trainStopIndex; i < followingStops.length; i++) {
|
||||||
|
const stop = followingStops[i];
|
||||||
|
|
||||||
|
if (/strong|podg/g.test(stop.stopName) && !nextStationName && i > trainStopIndex)
|
||||||
|
nextStationName = stop.stopNameRAW.replace(/,.*/g, '');
|
||||||
|
|
||||||
|
if (stop.departureLine && !departureLine && !/-|_|it|sbl/gi.test(stop.departureLine)) {
|
||||||
|
departureLine = stop.departureLine;
|
||||||
|
nextArrivalLine = followingStops[i + 1]?.arrivalLine || null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,8 +159,8 @@ export function getCheckpointTrain(
|
|||||||
|
|
||||||
region: train.region,
|
region: train.region,
|
||||||
|
|
||||||
arrivingLine,
|
arrivingLine: arrivingLine,
|
||||||
departureLine,
|
departureLine: departureLine,
|
||||||
|
|
||||||
nextArrivalLine,
|
nextArrivalLine,
|
||||||
prevDepartureLine
|
prevDepartureLine
|
||||||
@@ -192,7 +174,7 @@ export function getScheduledTrains(
|
|||||||
region: string
|
region: string
|
||||||
// sceneryData: API.ActiveSceneries.Data,
|
// sceneryData: API.ActiveSceneries.Data,
|
||||||
): ScheduledTrain[] {
|
): ScheduledTrain[] {
|
||||||
stationGeneralInfo?.checkpoints.forEach((cp) => (cp.scheduledTrains.length = 0));
|
// stationGeneralInfo?.checkpoints.forEach((cp) => (cp.scheduledTrains.length = 0));
|
||||||
|
|
||||||
return trainList.reduce((acc: ScheduledTrain[], train) => {
|
return trainList.reduce((acc: ScheduledTrain[], train) => {
|
||||||
if (!train.timetableData) return acc;
|
if (!train.timetableData) return acc;
|
||||||
@@ -201,32 +183,19 @@ export function getScheduledTrains(
|
|||||||
const timetable = train.timetableData;
|
const timetable = train.timetableData;
|
||||||
if (!timetable.sceneryNames.includes(stationName)) return acc;
|
if (!timetable.sceneryNames.includes(stationName)) return acc;
|
||||||
|
|
||||||
const stopInfoIndex = timetable.followingStops.findIndex((stop) => {
|
const checkpoints = [stationName];
|
||||||
return stationName.toLocaleLowerCase() == stop.stopNameRAW.toLocaleLowerCase();
|
if (stationGeneralInfo?.checkpoints) checkpoints.push(...stationGeneralInfo.checkpoints);
|
||||||
});
|
|
||||||
|
|
||||||
const checkpointScheduledTrains: ScheduledTrain[] = [];
|
const checkpointScheduledTrains: ScheduledTrain[] = [];
|
||||||
|
for (let i = 0; i < timetable.followingStops.length; i++) {
|
||||||
if (stopInfoIndex != -1) {
|
|
||||||
checkpointScheduledTrains.push(getCheckpointTrain(train, stopInfoIndex, stationName));
|
|
||||||
}
|
|
||||||
|
|
||||||
stationGeneralInfo?.checkpoints?.forEach((checkpoint) => {
|
|
||||||
if (
|
if (
|
||||||
checkpointScheduledTrains.findIndex(
|
new RegExp(`^(${checkpoints.join('|')})$`, 'i').test(
|
||||||
(cpTrain) =>
|
timetable.followingStops[i].stopNameRAW
|
||||||
cpTrain.checkpointName.toLocaleLowerCase() ==
|
|
||||||
checkpoint.checkpointName.toLocaleLowerCase()
|
|
||||||
) != -1
|
|
||||||
)
|
)
|
||||||
return;
|
) {
|
||||||
|
checkpointScheduledTrains.push(getCheckpointTrain(train, i, stationName));
|
||||||
const index = timetable.followingStops.findIndex(
|
}
|
||||||
(stop) => stop.stopNameRAW.toLowerCase() == checkpoint.checkpointName.toLowerCase()
|
}
|
||||||
);
|
|
||||||
|
|
||||||
if (index > -1) checkpointScheduledTrains.push(getCheckpointTrain(train, index, stationName));
|
|
||||||
});
|
|
||||||
|
|
||||||
acc.push(...checkpointScheduledTrains);
|
acc.push(...checkpointScheduledTrains);
|
||||||
return acc;
|
return acc;
|
||||||
|
|||||||
@@ -169,11 +169,7 @@ export default defineComponent({
|
|||||||
loadSelectedCheckpoint() {
|
loadSelectedCheckpoint() {
|
||||||
if (!this.stationInfo?.generalInfo?.checkpoints) return;
|
if (!this.stationInfo?.generalInfo?.checkpoints) return;
|
||||||
if (this.stationInfo.generalInfo.checkpoints.length == 0) return;
|
if (this.stationInfo.generalInfo.checkpoints.length == 0) return;
|
||||||
this.selectedCheckpoint = this.stationInfo.generalInfo.checkpoints[0].checkpointName;
|
this.selectedCheckpoint = this.stationInfo.generalInfo.checkpoints[0];
|
||||||
},
|
|
||||||
|
|
||||||
selectCheckpoint(cp: { checkpointName: string }) {
|
|
||||||
this.selectedCheckpoint = cp.checkpointName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user