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

Changing airports to EHAM throws #185

Closed
n8rzz opened this issue Dec 11, 2016 · 3 comments
Closed

Changing airports to EHAM throws #185

n8rzz opened this issue Dec 11, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@n8rzz
Copy link
Owner

n8rzz commented Dec 11, 2016

ref: zlsa#754

this fails in v3.1.0 due to a _comment key within the stars definition.

In v3.2.0 that has been addressed, however, this still fails from within the PositionModel.

PositionModel.calculatePosition = (coordinates, referencePostion, magneticNorth) => {
    if (!coordinates || !referencePostion || !magneticNorth) {
        throw new TypeError('Invalid parameter. PositionModel.getPosition() requires coordinates, referencePostion ' +
            'and magneticNorth as parameters');
    }

    // ...

magneticNorth is being evaluated as falsey (magneticNorth = 0) thus, it throws.

@n8rzz n8rzz added the bug label Dec 11, 2016
@n8rzz n8rzz added this to the v3.2.0 milestone Dec 11, 2016
@n8rzz n8rzz changed the title Chageing airports to EHAM throws Changeing airports to EHAM throws Dec 11, 2016
@n8rzz
Copy link
Owner Author

n8rzz commented Dec 11, 2016

this may be fixed by future refactor #178

@n8rzz
Copy link
Owner Author

n8rzz commented Dec 11, 2016

  • add test case for failing condition:
ava('.calculatePosition() does not throw when it receives 0 for magnetic_north', t => {
    t.notThrows(() => new PositionModel(LAT_LONG_MOCK, airportPositionFixtureKLAS, 0));
    t.notThrows(() => PositionModel.calculatePosition(LAT_LONG_MOCK, airportPositionFixtureKLAS, 0));
});
  • update PositionModel to handle magnetic_north of 0

@n8rzz
Copy link
Owner Author

n8rzz commented Dec 11, 2016

looks to be the same problem within the AirspaceModel, where we are using !magneticNorth which evaluates to false when 0 passed

@n8rzz n8rzz self-assigned this Dec 11, 2016
@n8rzz n8rzz changed the title Changeing airports to EHAM throws Changing airports to EHAM throws Dec 11, 2016
@n8rzz n8rzz mentioned this issue Dec 11, 2016
@n8rzz n8rzz closed this as completed Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant