Poprawki w sortowaniu scenerii

This commit is contained in:
2022-01-10 21:00:35 +01:00
parent 3cf59bf6dc
commit e21be10772
2 changed files with 4 additions and 13 deletions
+3 -12
View File
@@ -5,10 +5,10 @@ import StorageManager from './storageManager';
const sortStations = (a: Station, b: Station, sorter: { index: number; dir: number }) => {
switch (sorter.index) {
case 1:
if ((a.generalInfo?.reqLevel || -1 ) > (b.generalInfo?.reqLevel || -1)) return sorter.dir;
if ((a.generalInfo?.reqLevel || -1) < (b.generalInfo?.reqLevel || -1)) return -sorter.dir;
if ((a.generalInfo?.reqLevel || 0) > (b.generalInfo?.reqLevel || 0)) return sorter.dir;
if ((a.generalInfo?.reqLevel || 0) < (b.generalInfo?.reqLevel || 0)) return -sorter.dir;
break;
case 2:
if ((a.onlineInfo?.statusTimestamp || 0) > (b.onlineInfo?.statusTimestamp || 0)) return sorter.dir;
if ((a.onlineInfo?.statusTimestamp || 0) < (b.onlineInfo?.statusTimestamp || 0)) return -sorter.dir;
@@ -195,15 +195,6 @@ export default class StationFilterManager {
this.filters[prop] = !this.filters[prop];
})
// for(let prop in this.filters) {
// if(typeof prop !== "boolean") continue;
// this.filters[prop] = !this.filterInitStates[prop];
// console.log("inverted!");
// }
}
changeSorter(index: number) {
+1 -1
View File
@@ -282,7 +282,7 @@ export const store = createStore<State>({
url: station[1],
lines: station[2],
project: station[3],
reqLevel: station[4] == "" ? -1 : Number(station[4]),
reqLevel: station[4] == "" || station[4] === null ? -1 : Number(station[4]),
supportersOnly: station[5] == "TAK",
signalType: station[6],
controlType: station[7],