etherisc / flightdelay-ui

https://flightdelay.app
Apache License 2.0
0 stars 0 forks source link

[Bug]: flight not shown that returns data on flightstats API #108

Closed matthiaszimmermann closed 1 month ago

matthiaszimmermann commented 1 month ago

What happened?

observation: no option to buy a policy for BA 285 2024-10-14 (BA 285 2024-10-15 works) expectation: should be possible to buy a policy

initial analysis: flightstats api seems to return schedule and ratings information (see curl commands below). somehow the webapp is not picking this up?

curl -X GET https://api.flightstats.com/flex/schedules/rest/v1/json/flight/BA/285/departing/2024/10/14\?appId\=96875f77\&appKey\= curl -X GET https://api.flightstats.com/flex/ratings/rest/v1/json/flight/BA/285\?appId\=96875f77\&appKey\=

What operating system are you seeing the problem on?

Mac OS

What browsers are you seeing the problem on?

Brave

What wallet extension are you using?

Metamask

Rules

matthiaszimmermann commented 1 month ago

localhost_Archive [BA28520241014].har.gz localhost_Archive [BA28520241015].har.gz

matthiaszimmermann commented 1 month ago

curl respones for schedules call

curl -X GET https://api.flightstats.com/flex/schedules/rest/v1/json/flight/BA/285/departing/2024/10/14\?appId\=96875f77\&appKey\= {"request":{"carrier":{"requestedCode":"BA","fsCode":"BA"},"flightNumber":{"requested":"285","interpreted":"285"},"departing":true,"url":"https://api.flightstats.com/flex/schedules/rest/v1/json/flight/BA/285/departing/2024/10/14","date":{"year":"2024","month":"10","day":"14","interpreted":"2024-10-14"}},"scheduledFlights":[],"appendix":{"airlines":[{"fs":"BA","iata":"BA","icao":"BAW","name":"British Airways","active":true}],"airports":[],"equipments":[]}}%

matthiaszimmermann commented 1 month ago

curl response for ratings call

curl -X GET https://api.flightstats.com/flex/ratings/rest/v1/json/flight/BA/285\?appId\=96875f77\&appKey\= {"request":{"airlineCode":{"requestedCode":"BA","fsCode":"BA"},"flightNumber":{"requested":"285","interpreted":"285"},"url":"https://api.flightstats.com/flex/ratings/rest/v1/json/flight/BA/285"},"ratings":[{"airlineFsCode":"BA","flightNumber":"285","departureAirportFsCode":"LHR","arrivalAirportFsCode":"SFO","codeshares":0,"directs":0,"observations":61,"ontime":38,"late15":8,"late30":3,"late45":9,"cancelled":3,"diverted":0,"ontimePercent":0.623,"delayObservations":39,"delayMean":30.76923076923077,"delayStandardDeviation":37.624503171024024,"delayMin":0,"delayMax":173,"allOntimeCumulative":0.0107,"allOntimeStars":0.1,"allDelayCumulative":0.5793,"allDelayStars":2.9,"allStars":1.5}],"appendix":{"airlines":[{"fs":"BA","iata":"BA","icao":"BAW","name":"British Airways","active":true}],"airports":[{"fs":"LHR","iata":"LHR","icao":"EGLL","faa":"","name":"London Heathrow Airport","city":"London","cityCode":"LON","stateCode":"EN","countryCode":"GB","countryName":"United Kingdom","regionName":"Europe","timeZoneRegionName":"Europe/London","weatherZone":"","localTime":"2024-10-16T08:58:20.767","utcOffsetHours":1.0,"latitude":51.469603,"longitude":-0.453566,"elevationFeet":80,"classification":1,"active":true},{"fs":"SFO","iata":"SFO","icao":"KSFO","faa":"SFO","name":"San Francisco International Airport","city":"San Francisco","cityCode":"SFO","stateCode":"CA","postalCode":"94128","countryCode":"US","countryName":"United States","regionName":"North America","timeZoneRegionName":"America/Los_Angeles","weatherZone":"CAZ508","localTime":"2024-10-16T00:58:20.767","utcOffsetHours":-7.0,"latitude":37.615215,"longitude":-122.389881,"elevationFeet":11,"classification":1,"active":true}]}}%

matthiaszimmermann commented 1 month ago

server log (1x BA 285 2024-10-15, 1x BA 285 2024-10-14):

{"level":"debug","message":"[PLnt8UsNTPS4DHWrAhHxp] fetching flight status for BA 285 2024-10-15","timestamp":"2024-10-16 08:01:30"} {"level":"debug","message":"proxy request ==> GET https://api.flightstats.com/flex/schedules/rest/v1/json/flight/BA/285/departing/2024/10/15?appId=96875f77&appKey=dc097f38175fd39620c72b94fc79be05","reqId":"PLnt8UsNTPS4DHWrAhHxp","timestamp":"2024-10-16 08:01:30"} {"level":"debug","message":"proxy response <== 200","proxyRequestDuration":420,"reqId":"PLnt8UsNTPS4DHWrAhHxp","timestamp":"2024-10-16 08:01:30"} GET /api/flightstats/schedule/BA/285/2024-10-15 200 in 453ms {"level":"debug","message":"[blme95zN-0TwA6yn4qDGU] fetching quote for BA 285","timestamp":"2024-10-16 08:01:31"} {"level":"debug","message":"proxy request ==> GET https://api.flightstats.com/flex/ratings/rest/v1/json/flight/BA/285?appId=96875f77&appKey=dc097f38175fd39620c72b94fc79be05","reqId":"blme95zN-0TwA6yn4qDGU","timestamp":"2024-10-16 08:01:31"} {"level":"debug","message":"proxy response <== 200","proxyRequestDuration":123,"reqId":"blme95zN-0TwA6yn4qDGU","timestamp":"2024-10-16 08:01:31"} {"level":"info","message":"[blme95zN-0TwA6yn4qDGU] Ratings:ontime 38, observations: 61, late15 8, late30 3, late45 9, cancelled 3, diverted 0 ontimepercent 0.623","timestamp":"2024-10-16 08:01:31"} {"level":"debug","message":"[blme95zN-0TwA6yn4qDGU] calling calculatePayoutAmounts 15000000","timestamp":"2024-10-16 08:01:31"} {"level":"info","message":"calculatePayoutAmounts => 89507, 0,0,50275397,83792329,83792329, 83792329","timestamp":"2024-10-16 08:01:31"} GET /api/quote/BA/285 200 in 356ms

{"level":"debug","message":"[Xd6P4JWwbPA8W5-MPRZ2x] fetching flight status for BA 285 2024-10-14","timestamp":"2024-10-16 08:01:42"} {"level":"debug","message":"proxy request ==> GET https://api.flightstats.com/flex/schedules/rest/v1/json/flight/BA/285/departing/2024/10/14?appId=96875f77&appKey=dc097f38175fd39620c72b94fc79be05","reqId":"Xd6P4JWwbPA8W5-MPRZ2x","timestamp":"2024-10-16 08:01:42"} {"level":"debug","message":"proxy response <== 200","proxyRequestDuration":372,"reqId":"Xd6P4JWwbPA8W5-MPRZ2x","timestamp":"2024-10-16 08:01:43"} GET /api/flightstats/schedule/BA/285/2024-10-14 200 in 463ms

matthiaszimmermann commented 1 month ago

potentially anoter such flight is KL843 on 2024-11-12

doerfli commented 1 month ago

Flightstats provides no rating data for KL843 and therefor we cannot calculate a quote.

doerfli commented 1 month ago

going to switch error text in this case to make it more clear.

doerfli commented 1 month ago
Flightdelay