mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Fix: niepoprawne wyświetlanie statusów dyżurnych
This commit is contained in:
@@ -6,7 +6,7 @@ export const getLocoURL = (locoType: string): string => (`https://rj.td2.info.pl
|
||||
|
||||
export const getStatusID = (stationStatus: any): string => {
|
||||
if (!stationStatus) return "unknown";
|
||||
if (stationStatus == -1) return "unavailable";
|
||||
if (stationStatus == -1) return "not-signed";
|
||||
|
||||
const statusCode = stationStatus[2];
|
||||
const statusTimestamp = stationStatus[3];
|
||||
@@ -31,7 +31,7 @@ export const getStatusID = (stationStatus: any): string => {
|
||||
break;
|
||||
}
|
||||
|
||||
return "not-signed";
|
||||
return "unavailable";
|
||||
};
|
||||
|
||||
export const getStatusTimestamp = (stationStatus: any): number => {
|
||||
|
||||
+4
-2
@@ -166,9 +166,11 @@ export const store = createStore<State>({
|
||||
|
||||
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 statusTimestamp = prevDispatcherStatus && !data.dispatchers ? prevDispatcherStatus.statusTimestamp : getStatusTimestamp(stationStatus);
|
||||
const statusID = prevDispatcherStatus && !data.dispatchers ? prevDispatcherStatus.statusID : getStatusID(stationStatus);
|
||||
|
||||
const statusTimestamp = getStatusTimestamp(stationStatus == -1 && prevDispatcherStatus ? prevDispatcherStatus.statusTimestamp : stationStatus);
|
||||
const statusID = getStatusID(stationStatus == -1 && prevDispatcherStatus ? prevDispatcherStatus.statusID : stationStatus);
|
||||
console.log(stationName, prevDispatcherStatus);
|
||||
|
||||
prevDispatcherStatuses.push({
|
||||
hash: stationAPI.stationHash,
|
||||
|
||||
Reference in New Issue
Block a user