Skip to content

Commit

Permalink
Attempt for temp fix #13
Browse files Browse the repository at this point in the history
Extrapolate heading by rw number
  • Loading branch information
jbud committed Dec 10, 2023
1 parent c2bd18e commit b65fcea
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/form/formutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,35 @@ export const useApi = (): [
fetch('./database/runways/icao/' + icao + '.json')
.then((response) => response.json())
.then((data) => {
let dataMissing = false;
let extrapolatedHeading = '0';
const rws = data.runways;
const rwList: RunwaysForm[] = []; //{ value: '', heading: '', elevation: '', length: '' },
for (let i = 0; i < rws.length; i++) {
if (rws[i].he_heading_degT === '') {
// convert runway ident to heading
extrapolatedHeading =
rws[i].he_ident.substring(0, 2) + 0;
dataMissing = true;
}
if (rws[i].le_heading_degT === '') {
extrapolatedHeading =
rws[i].le_ident.substring(0, 2) + 0;
dataMissing = true;
}
rwList.push({
value: rws[i].he_ident,
heading: rws[i].he_heading_degT,
heading: dataMissing
? extrapolatedHeading
: rws[i].he_heading_degT,
elevation: data.elevation_ft,
length: rws[i].length_ft,
});
rwList.push({
value: rws[i].le_ident,
heading: rws[i].le_heading_degT,
heading: dataMissing
? extrapolatedHeading
: rws[i].le_heading_degT,
elevation: data.elevation_ft,
length: rws[i].length_ft,
});
Expand Down

0 comments on commit b65fcea

Please sign in to comment.