Skip to content

Commit

Permalink
Removed the skip when the countrygroup has no active positions, becau…
Browse files Browse the repository at this point in the history
…se maybe an airspace has an owner in an other countrygroup which is referenced like fss/EURM
  • Loading branch information
FX5F committed Jan 19, 2025
1 parent 81150e5 commit b72d792
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/utils/data/vatglasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function updateVatglassesPositionsAndAirspaces() {
}

// TODO: sort firs by the same as EuroScope sorts the positions before assigning logged in stations to a position
// let first = 0; // used for debug
const firs = dataStore?.vatsim?.data?.firs.value ?? workerDataStore?.vatsim?.firs;
for (const fir of [...firs, ...arrivalController]) { // this has an entry for each center controller connected. const fir is basically a center controller
// In data.firs it is called controller, in data.locals it is called atc, so we have to get the correct one
Expand All @@ -122,6 +123,25 @@ function updateVatglassesPositionsAndAirspaces() {
}
if (!atc) continue;

// // used for debug
// if (first === 0) {
// atc.frequency = '135.050';
// atc.callsign = 'AFRE_FSS';
// atc.cid = 1025793;
// first++;
// }
// else if (first === 1) {
// break;
// if (calls > 3) break;
// atc.frequency = '129.100';
// atc.callsign = 'EDMM_ALB_CTR';
// atc.cid = 1025794;
// // first++;
// }
// else {
// break;
// }

let foundMatchingVatglassesController = false;
let doublePositionMatch = false;
// We sort the keys with the first two chars of the callsign, so we can check first the most likely countryGroupIds
Expand Down Expand Up @@ -165,10 +185,10 @@ function updateVatglassesPositionsAndAirspaces() {
// Fill the vatglassesActiveAirspaces object with the active airspaces
vatglassesActiveAirspaces = {};
for (const countryGroupId in vatglassesData) {
if (!vatglassesActiveController[countryGroupId]) continue;// countryGroup has no active positions
const countryGroup = vatglassesData[countryGroupId];

const activeGroupVatglassesPosition = Object.keys(vatglassesActiveController[countryGroupId]);
let activeGroupVatglassesPosition: string[] = [];
if (vatglassesActiveController[countryGroupId]) activeGroupVatglassesPosition = Object.keys(vatglassesActiveController[countryGroupId]);
for (const [airspaceIndex, airspace] of countryGroup.airspace.entries()) {
const vatglassesPositionId = airspace.owner.find((element: string) => {
if (element.includes('/')) { // Covers this cases: Positions from other data files can be referenced in the format country/position, where position is defined in country.json
Expand Down

0 comments on commit b72d792

Please sign in to comment.