mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Fix statusów scenerii
This commit is contained in:
+2
-1
@@ -158,6 +158,7 @@ export const store = createStore<State>({
|
|||||||
const onlineStationNames: string[] = [];
|
const onlineStationNames: string[] = [];
|
||||||
const prevDispatcherStatuses: State['lastDispatcherStatuses'] = [];
|
const prevDispatcherStatuses: State['lastDispatcherStatuses'] = [];
|
||||||
|
|
||||||
|
console.log(data.dispatchers);
|
||||||
data.stations?.forEach((stationAPI) => {
|
data.stations?.forEach((stationAPI) => {
|
||||||
if (stationAPI.region !== this.state.region.id || !stationAPI.isOnline) return;
|
if (stationAPI.region !== this.state.region.id || !stationAPI.isOnline) return;
|
||||||
|
|
||||||
@@ -167,7 +168,7 @@ export const store = createStore<State>({
|
|||||||
const station = this.state.stationList.find(s => s.name == stationAPI.stationName);
|
const station = this.state.stationList.find(s => s.name == stationAPI.stationName);
|
||||||
|
|
||||||
const prevDispatcherStatus = this.state.lastDispatcherStatuses.find(dispatcher => dispatcher.hash === stationAPI.stationHash);
|
const prevDispatcherStatus = this.state.lastDispatcherStatuses.find(dispatcher => dispatcher.hash === stationAPI.stationHash);
|
||||||
const stationStatus = data.dispatchers?.find((status: string[]) => status[0] == stationAPI.stationHash && status[1] == this.state.region.id) || -1;
|
const stationStatus = !data.dispatchers ? undefined : data.dispatchers.find((status: string[]) => status[0] == stationAPI.stationHash && status[1] == this.state.region.id) || -1;
|
||||||
|
|
||||||
const statusTimestamp = prevDispatcherStatus && !data.dispatchers ? prevDispatcherStatus.statusTimestamp : getStatusTimestamp(stationStatus);
|
const statusTimestamp = prevDispatcherStatus && !data.dispatchers ? prevDispatcherStatus.statusTimestamp : getStatusTimestamp(stationStatus);
|
||||||
const statusID = prevDispatcherStatus && !data.dispatchers ? prevDispatcherStatus.statusID : getStatusID(stationStatus);
|
const statusID = prevDispatcherStatus && !data.dispatchers ? prevDispatcherStatus.statusID : getStatusID(stationStatus);
|
||||||
|
|||||||
Reference in New Issue
Block a user