Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Changes airport sorting. Fixes AB#1 #29

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@


=======
[![Build Status](https://dev.azure.com/wawong/MSReadyContosoAir/_apis/build/status/warrenwwc.ContosoAir?branchName=master)](https://dev.azure.com/wawong/MSReadyContosoAir/_build/latest?definitionId=6&branchName=master)

# Microsoft.Github CI Demo

Demo website application for Contoso Air.
Runs a nodejs server (Express v4.16) that stores customer booked flights in a CosmosDb database.

## Requirements
Expand Down
6 changes: 5 additions & 1 deletion src/services/airports.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ class AirportsService {
this._airports = airports;
}

// getAll(){
// return this._airports.filter(a => a.code).map(avoidEmptyCity);
// }

getAll(){
return this._airports.filter(a => a.code).map(avoidEmptyCity);
return this._airports.filter(a => a.code).map(avoidEmptyCity).sort((a, b) => (a.city > b.city) ? 1 : -1);
}

getByCode(code) {
Expand Down
4 changes: 4 additions & 0 deletions src/services/book.form.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class BookFormService {
airports: this._airports.getAll()
};
}

getAll(){
return this._airports.filter(a => a.code).map(avoidEmptyCity).sort((a, b) => (a.city > b.city) ? 1 : -1);
}
}

module.exports = BookFormService;