[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kitinerary] /: Propagate country information for airports
From: Volker Krause <null () kde ! org>
Date: 2018-05-21 15:24:16
Message-ID: E1fKmfY-0006hh-SR () code ! kde ! org
[Download RAW message or body]
Git commit e31b815c27a87a3d9cc3e0f6faa0d39a829cf58c by Volker Krause.
Committed on 21/05/2018 at 15:23.
Pushed by vkrause into branch 'master'.
Propagate country information for airports
M +4 -2 autotests/calendarhandlerdata/flight.ics
M +8 -0 autotests/pkpassdata/airbaltic.json
M +8 -0 autotests/pkpassdata/airberlin.json
M +8 -0 autotests/pkpassdata/eurowings.json
M +8 -0 autotests/pkpassdata/lufthansa.json
M +8 -0 autotests/pkpassdata/swiss.json
M +8 -0 autotests/postprocessordata/bcbp-expansion.post.json
M +8 -0 autotests/postprocessordata/flight-augment.post.json
M +8 -0 autotests/postprocessordata/flight-merge.post.json
M +8 -0 autotests/postprocessordata/lh-incomplete-departure-time.post.json
M +10 -0 src/extractorpostprocessor.cpp
https://commits.kde.org/kitinerary/e31b815c27a87a3d9cc3e0f6faa0d39a829cf58c
diff --git a/autotests/calendarhandlerdata/flight.ics \
b/autotests/calendarhandlerdata/flight.ics index 4937cd4..0094efa 100644
--- a/autotests/calendarhandlerdata/flight.ics
+++ b/autotests/calendarhandlerdata/flight.ics
@@ -20,13 +20,15 @@ X-KDE-KITINERARY-RESERVATION:[{"@context":"http://schema.org"\,"@type":
//www.airberlin.com/de-DE/cockpit/index/index/bookingNo/XXX007/lastname/DO
E/submit/1"\,"reservationFor":{"@type":"Flight"\,"airline":{"@type":
"Airline"\,"iataCode":"AB"\,"name":"airberlin"}\,"arrivalAirport":
- {"@type":"Airport"\,"geo":{"@type":"GeoCoordinates"\,"latitude":
+ {"@type":"Airport"\,"address":{"@type":"PostalAddress"\,"addressCountry":
+ "DE"}\,"geo":{"@type":"GeoCoordinates"\,"latitude":
52.55970001220703\,"longitude":13.287799835205078}\,"iataCode":
"TXL"\,"name":"Berlin (Tegel)"}\,"arrivalTime":{"@type":
"QDateTime"\,"@value":"2017-09-20T16:00:00+02:00"\,"timezone":
"Europe/Berlin"}\,"boardingTime":{"@type":"QDateTime"\,"@value":
"2017-09-20T14:25:00+03:00"\,"timezone":
- "Europe/Helsinki"}\,"departureAirport":{"@type":"Airport"\,"geo":{"@type":
+ "Europe/Helsinki"}\,"departureAirport":{"@type":"Airport"\,"address":
+ {"@type":"PostalAddress"\,"addressCountry":"FI"}\,"geo":{"@type":
"GeoCoordinates"\,"latitude":60.31719970703125\,"longitude":
24.963300704956055}\,"iataCode":"HEL"\,"name":"Helsinki"}\,"departureDay":
"2017-09-20"\,"departureGate":"16"\,"departureTime":{"@type":
diff --git a/autotests/pkpassdata/airbaltic.json \
b/autotests/pkpassdata/airbaltic.json index d6926fd..a0a01b6 100644
--- a/autotests/pkpassdata/airbaltic.json
+++ b/autotests/pkpassdata/airbaltic.json
@@ -11,6 +11,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "LV"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 56.92359924316406,
@@ -25,6 +29,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 52.55970001220703,
diff --git a/autotests/pkpassdata/airberlin.json \
b/autotests/pkpassdata/airberlin.json index 6ee5fb2..6b00724 100644
--- a/autotests/pkpassdata/airberlin.json
+++ b/autotests/pkpassdata/airberlin.json
@@ -11,6 +11,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 48.35390090942383,
@@ -25,6 +29,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 52.559688568115234,
diff --git a/autotests/pkpassdata/eurowings.json \
b/autotests/pkpassdata/eurowings.json index 166a5c8..f66ce67 100644
--- a/autotests/pkpassdata/eurowings.json
+++ b/autotests/pkpassdata/eurowings.json
@@ -12,6 +12,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 52.55970001220703,
@@ -27,6 +31,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "GB"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 51.477500915527344,
diff --git a/autotests/pkpassdata/lufthansa.json \
b/autotests/pkpassdata/lufthansa.json index c8c9382..5855133 100644
--- a/autotests/pkpassdata/lufthansa.json
+++ b/autotests/pkpassdata/lufthansa.json
@@ -11,6 +11,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 52.55970001220703,
@@ -26,6 +30,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 48.35390090942383,
diff --git a/autotests/pkpassdata/swiss.json b/autotests/pkpassdata/swiss.json
index 8546f57..a791821 100644
--- a/autotests/pkpassdata/swiss.json
+++ b/autotests/pkpassdata/swiss.json
@@ -13,6 +13,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 52.55970001220703,
@@ -27,6 +31,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "CH"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 47.452301025390625,
diff --git a/autotests/postprocessordata/bcbp-expansion.post.json \
b/autotests/postprocessordata/bcbp-expansion.post.json index 3d18feb..aeca939 100644
--- a/autotests/postprocessordata/bcbp-expansion.post.json
+++ b/autotests/postprocessordata/bcbp-expansion.post.json
@@ -11,6 +11,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 50.03329849243164,
@@ -25,6 +29,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "CA"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 45.47060012817383,
diff --git a/autotests/postprocessordata/flight-augment.post.json \
b/autotests/postprocessordata/flight-augment.post.json index a9627cd..04f9ca1 100644
--- a/autotests/postprocessordata/flight-augment.post.json
+++ b/autotests/postprocessordata/flight-augment.post.json
@@ -10,6 +10,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "US"
+ },
"geo": {
"@type": "GeoCoordinates",
"longitude": -77.45580291748047,
@@ -25,6 +29,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "US"
+ },
"geo": {
"@type": "GeoCoordinates",
"longitude": -122.30899810791016,
diff --git a/autotests/postprocessordata/flight-merge.post.json \
b/autotests/postprocessordata/flight-merge.post.json index c01626e..c2e51b7 100644
--- a/autotests/postprocessordata/flight-merge.post.json
+++ b/autotests/postprocessordata/flight-merge.post.json
@@ -14,6 +14,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "FR"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 43.6349983215332,
@@ -34,6 +38,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "BE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 50.88970184326172,
diff --git a/autotests/postprocessordata/lh-incomplete-departure-time.post.json \
b/autotests/postprocessordata/lh-incomplete-departure-time.post.json index \
03b0ec9..949c31a 100644
--- a/autotests/postprocessordata/lh-incomplete-departure-time.post.json
+++ b/autotests/postprocessordata/lh-incomplete-departure-time.post.json
@@ -12,6 +12,10 @@
},
"arrivalAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 52.55970001220703,
@@ -27,6 +31,10 @@
},
"departureAirport": {
"@type": "Airport",
+ "address": {
+ "@type": "PostalAddress",
+ "addressCountry": "DE"
+ },
"geo": {
"@type": "GeoCoordinates",
"latitude": 48.35390090942383,
diff --git a/src/extractorpostprocessor.cpp b/src/extractorpostprocessor.cpp
index ca2a17d..6265e00 100644
--- a/src/extractorpostprocessor.cpp
+++ b/src/extractorpostprocessor.cpp
@@ -217,6 +217,16 @@ Airport ExtractorPostprocessorPrivate::processAirport(Airport \
airport) const }
}
+ // add country
+ auto addr = airport.address();
+ if (addr.addressCountry().isEmpty()) {
+ const auto isoCode = \
AirportDb::countryForAirport(AirportDb::IataCode{iataCode}); + if \
(isoCode.isValid()) { + addr.setAddressCountry(isoCode.toString());
+ airport.setAddress(addr);
+ }
+ }
+
return processPlace(airport);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic