Skip to content

Commit

Permalink
Merge pull request #226 from n8rzz/feature/ATC-175
Browse files Browse the repository at this point in the history
feature/ATC-175
  • Loading branch information
n8rzz authored Dec 19, 2016
2 parents 02c6844 + b8ebda4 commit 2de04cf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
14 changes: 2 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
- Rewrites the CommandParser from the ground up [#114](https://github.com/n8rzz/atc/issues/114)
- Removes `Pegjs` and references completing switch to new CommandParser [#216](https://github.com/n8rzz/atc/issues/216)



### Minor
- Implements `modelSourceFactory` and `modelSourcePool` [#77](https://github.com/n8rzz/atc/issues/77)
- Refactors `canvasController.canvas_draw_sids` method to use `airport.sidCollection` instead of `airport.sid` [#144](https://github.com/n8rzz/atc/issues/144)
Expand All @@ -28,19 +26,13 @@
- Updates `PositionModel` to run all calculations through the static `.calculatePosition()` method and vastly simplifies internal logic.
- Refactors the the function names in `FixCollection` to better fit their function. `init()` to `addItems()` and `destroy()` to `removeItems()` [#186] (https://github.com/n8rzz/atc/issues/186)
- Adds gulp-cli and adds [tools readme](tools/README.md) link to gulp issues with Windows [#194](https://github.com/n8rzz/atc/issues/194)
- Changes `routeString` to `routeCode` in `RouteModel` and moves `.toUpperCase()` from the getter to `.init()` [#188] (https://github.com/n8rzz/atc/issues/188)
- Updates `StandardRouteModel` to throw when entry/exit point doesn't exist within a collection and updates `.setDepartureRunway()` to send the `routeCode` to `Leg` on instantiation [#175](https://github.com/n8rzz/atc/issues/175)
- Prevents collision detection for aircraft that are outside of our airspace [#134](https://github.com/n8rzz/atc/issues/134)
- Originally reported under [#736](https://github.com/zlsa/atc/issues/736)
- Changes `routeString` to `routeCode` in `routeModel` [#188] (https://github.com/n8rzz/atc/issues/188)
-`.toUpperCase()` is now called on initialization and removed from the getter
- Escape clears commands but not callsign if commands are present [#211] (https://github.com/n8rzz/atc/issues/211)
- Originally reported under [#763](https://github.com/zlsa/atc/issues/763)







### Bugfixes
- Moves `_comment` blocks in airport json file to be within object the are describing [#145](https://github.com/n8rzz/atc/issues/145)
- Streamlines flight number generation and adds new method to add new callsigns to the existing list [#151](https://github.com/n8rzz/atc/issues/151)
Expand All @@ -50,8 +42,6 @@
- Originally reported under [#706](https://github.com/zlsa/atc/issues/706)




## 3.1.0 (November 20, 2016)
---
### Major
Expand Down
2 changes: 1 addition & 1 deletion src/assets/scripts/aircraft/AircraftInstanceModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export default class Aircraft {
if (leg.type === 'sid') {
const a = _map(leg.waypoints, (v) => v.altitude);
const cvs = !a.every((v) => v === window.airportController.airport_get().initial_alt);
this.fms.followSID(leg.route);
this.fms.followSID(leg.route.routeCode);

if (cvs) {
this.fms.climbViaSID();
Expand Down
12 changes: 12 additions & 0 deletions src/assets/scripts/airport/StandardRoute/StandardRouteModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,23 @@ export default class StandardRouteModel extends BaseModel {

if (this._entryCollection) {
const entrySegment = this._entryCollection.findSegmentByName(entry);

if (typeof entrySegment === 'undefined') {
throw new TypeError(`Expected 'entry' to exist in the RouteSegmentCollection, but '${this.icao}' ` +
`does not have an entry of '${entry}'`);
}

entrySegmentItems = entrySegment.items;
}

if (this._exitCollection) {
const exitSegment = this._exitCollection.findSegmentByName(exit);

if (typeof exitSegment === 'undefined') {
throw new TypeError(`Expected 'exit' to exist in the RouteSegmentCollection, but '${this.icao}' ` +
`does not have an exit of '${exit}'`);
}

exitSegmentItems = exitSegment.items;
}

Expand Down
12 changes: 12 additions & 0 deletions test/airport/standardRoute/StandardRouteModel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,18 @@ ava('._findBodyFixList() returns an empty array when ._bodySegmentModel is undef
t.true(result.length === 0);
});

ava('._findStandardWaypointModelsForRoute() throws if entry does not exist within the collection', t => {
const model = new StandardRouteModel(STAR_MOCK);

t.throws(() => model._findStandardWaypointModelsForRoute('threeve', '25R'));
});

ava('._findStandardWaypointModelsForRoute() throws if exit does not exist within the collection', t => {
const model = new StandardRouteModel(STAR_MOCK);

t.throws(() => model._findStandardWaypointModelsForRoute('DRK', 'threeve'));
});

ava('._findStandardWaypointModelsForRoute() returns a list of StandardRouteWaypointModels when _entryCollection and _exitCollection exist', t => {
const model = new StandardRouteModel(STAR_MOCK);
const result = model._findStandardWaypointModelsForRoute(ENTRY_FIXNAME_MOCK, RUNWAY_NAME_MOCK);
Expand Down

0 comments on commit 2de04cf

Please sign in to comment.