Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the skip when the countrygroup has no active positions #655

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading