Skip to content

Commit

Permalink
Merge pull request #655 from FX5F/VGpositionFix
Browse files Browse the repository at this point in the history
Removed the skip when the countrygroup has no active positions
  • Loading branch information
daniluk4000 authored Jan 20, 2025
2 parents 90ffdf6 + b72d792 commit 38dc9f9
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 38dc9f9

Please sign in to comment.