From 120be648495fce1d8b9aa8ba6613854ef4859213 Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Mon, 12 Nov 2018 15:04:06 +0000 Subject: [PATCH 1/9] flight-fix --- endpoints/flight/index.js | 148 +++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index 5e3f44dd..41692831 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -1,74 +1,74 @@ -/* eslint-disable import/first */ -const request = require('request') -const h = require('apis-helpers') -const cheerio = require('cheerio') -const app = require('../../server') - -app.get('/flight', (req, res) => { - const data = req.query - let url = '' - let $ - - if (!data.type) data.type = '' - if (!data.language) data.language = '' - - if (data.type === 'departures' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' - } else if (data.type === 'departures' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Departures/' - } else if (data.type === 'arrivals' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Komur/' - } else if (data.type === 'arrivals' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' - } else { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' - } - - request.get({ - headers: { 'User-Agent': h.browser() }, - url, - }, (error, response, body) => { - if (error || response.statusCode !== 200) { - return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) - } - - try { - $ = cheerio.load(body) - } catch (err) { - return res.status(500).json({ error: 'Could not parse body' }) - } - - const obj = { results: [] } - - $('table tr').each(function (key) { - if (key !== 0) { - let flight = {} - if (data.type === 'departures') { - flight = { - date: $(this).children('td').slice(0).html(), - flightNumber: $(this).children('td').slice(1).html(), - airline: $(this).children('td').slice(2).html(), - to: $(this).children('td').slice(3).html(), - plannedArrival: $(this).children('td').slice(4).html(), - realArrival: $(this).children('td').slice(5).html(), - status: $(this).children('td').slice(6).html(), - } - } else { - flight = { - date: $(this).children('td').slice(0).html(), - flightNumber: $(this).children('td').slice(1).html(), - airline: $(this).children('td').slice(2).html(), - from: $(this).children('td').slice(3).html(), - plannedArrival: $(this).children('td').slice(4).html(), - realArrival: $(this).children('td').slice(5).html(), - status: $(this).children('td').slice(6).html(), - } - } - - obj.results.push(flight) - } - }) - - return res.cache(3600).json(obj) - }) -}) +/* eslint-disable import/first */ +const request = require('request') +const h = require('apis-helpers') +const cheerio = require('cheerio') +const app = require('../../server') + +app.get('/flight', (req, res) => { + const data = req.query + let url = '' + let $ + + if (!data.type) data.type = '' + if (!data.language) data.language = '' + + if (data.type === 'departures' && data.language === 'is') { + url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' + } else if (data.type === 'departures' && data.language === 'en') { + url = 'http://www.kefairport.is/English/Timetables/Departures/' + } else if (data.type === 'arrivals' && data.language === 'is') { + url = 'http://www.kefairport.is/Flugaaetlun/Komur/' + } else if (data.type === 'arrivals' && data.language === 'en') { + url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + } else { + url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + } + + request.get({ + headers: { 'User-Agent': h.browser() }, + url, + }, (error, response, body) => { + if (error || response.statusCode !== 200) { + return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) + } + + try { + $ = cheerio.load(body) + } catch (err) { + return res.status(500).json({ error: 'Could not parse body' }) + } + + const obj = { results: [] } + + $('.schedule-items-entry').each(function (key) { + if (key !== 0) { + let flight = {} + if (data.type === 'departures') { + flight = { + date: $(this).children('td').slice(0).html(), + flightNumber: $(this).children('td').slice(2).html(), + airline: $(this).children('td').slice(3).children('span').html(), + to: $(this).children('td').slice(1).children('span').html(), + plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var + realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + status: $(this).children('td').slice(4).children('span').html(), + } + } else { + flight = { + date: $(this).children('td').slice(0).html(), + flightNumber: $(this).children('td').slice(2).html(), + airline: $(this).children('td').slice(3).children('span').html(), + from: $(this).children('td').slice(1).children('span').html(), + plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var + realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + status: $(this).children('td').slice(4).children('span').html(), + } + } + + obj.results.push(flight) + } + }) + + return res.cache(3600).json(obj) + }) +}) \ No newline at end of file From f381c176542afa2a41723617a257ebd35de5ddfb Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Mon, 12 Nov 2018 15:13:00 +0000 Subject: [PATCH 2/9] flight-fix LF --- endpoints/flight/index.js | 146 +++++++++++++++++++------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index 41692831..afc1ba50 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -1,74 +1,74 @@ -/* eslint-disable import/first */ -const request = require('request') -const h = require('apis-helpers') -const cheerio = require('cheerio') -const app = require('../../server') - -app.get('/flight', (req, res) => { - const data = req.query - let url = '' - let $ - - if (!data.type) data.type = '' - if (!data.language) data.language = '' - - if (data.type === 'departures' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' - } else if (data.type === 'departures' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Departures/' - } else if (data.type === 'arrivals' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Komur/' - } else if (data.type === 'arrivals' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' - } else { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' - } - - request.get({ - headers: { 'User-Agent': h.browser() }, - url, - }, (error, response, body) => { - if (error || response.statusCode !== 200) { - return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) - } - - try { - $ = cheerio.load(body) - } catch (err) { - return res.status(500).json({ error: 'Could not parse body' }) - } - - const obj = { results: [] } - - $('.schedule-items-entry').each(function (key) { - if (key !== 0) { - let flight = {} - if (data.type === 'departures') { - flight = { - date: $(this).children('td').slice(0).html(), - flightNumber: $(this).children('td').slice(2).html(), - airline: $(this).children('td').slice(3).children('span').html(), - to: $(this).children('td').slice(1).children('span').html(), - plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var - realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it - status: $(this).children('td').slice(4).children('span').html(), - } - } else { - flight = { - date: $(this).children('td').slice(0).html(), - flightNumber: $(this).children('td').slice(2).html(), - airline: $(this).children('td').slice(3).children('span').html(), - from: $(this).children('td').slice(1).children('span').html(), - plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var - realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it - status: $(this).children('td').slice(4).children('span').html(), - } - } - - obj.results.push(flight) - } - }) - - return res.cache(3600).json(obj) - }) +/* eslint-disable import/first */ +const request = require('request') +const h = require('apis-helpers') +const cheerio = require('cheerio') +const app = require('../../server') + +app.get('/flight', (req, res) => { + const data = req.query + let url = '' + let $ + + if (!data.type) data.type = '' + if (!data.language) data.language = '' + + if (data.type === 'departures' && data.language === 'is') { + url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' + } else if (data.type === 'departures' && data.language === 'en') { + url = 'http://www.kefairport.is/English/Timetables/Departures/' + } else if (data.type === 'arrivals' && data.language === 'is') { + url = 'http://www.kefairport.is/Flugaaetlun/Komur/' + } else if (data.type === 'arrivals' && data.language === 'en') { + url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + } else { + url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + } + + request.get({ + headers: { 'User-Agent': h.browser() }, + url, + }, (error, response, body) => { + if (error || response.statusCode !== 200) { + return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) + } + + try { + $ = cheerio.load(body) + } catch (err) { + return res.status(500).json({ error: 'Could not parse body' }) + } + + const obj = { results: [] } + + $('.schedule-items-entry').each(function (key) { + if (key !== 0) { + let flight = {} + if (data.type === 'departures') { + flight = { + date: $(this).children('td').slice(0).html(), + flightNumber: $(this).children('td').slice(2).html(), + airline: $(this).children('td').slice(3).children('span').html(), + to: $(this).children('td').slice(1).children('span').html(), + plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var + realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + status: $(this).children('td').slice(4).children('span').html(), + } + } else { + flight = { + date: $(this).children('td').slice(0).html(), + flightNumber: $(this).children('td').slice(2).html(), + airline: $(this).children('td').slice(3).children('span').html(), + from: $(this).children('td').slice(1).children('span').html(), + plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var + realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + status: $(this).children('td').slice(4).children('span').html(), + } + } + + obj.results.push(flight) + } + }) + + return res.cache(3600).json(obj) + }) }) \ No newline at end of file From b4d1ee23fc2a5927f5223dac781ee31789c4fe48 Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Mon, 12 Nov 2018 15:42:26 +0000 Subject: [PATCH 3/9] flight-fix indentation fix --- endpoints/flight/index.js | 115 +++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index afc1ba50..49b2ded7 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -5,70 +5,69 @@ const cheerio = require('cheerio') const app = require('../../server') app.get('/flight', (req, res) => { - const data = req.query - let url = '' - let $ + const data = req.query + let url = '' + let $ - if (!data.type) data.type = '' - if (!data.language) data.language = '' + if (!data.type) data.type = '' + if (!data.language) data.language = '' - if (data.type === 'departures' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' - } else if (data.type === 'departures' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Departures/' - } else if (data.type === 'arrivals' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Komur/' - } else if (data.type === 'arrivals' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' - } else { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' - } + if (data.type === 'departures' && data.language === 'is') { + url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' + } else if (data.type === 'departures' && data.language === 'en') { + url = 'http://www.kefairport.is/English/Timetables/Departures/' + } else if (data.type === 'arrivals' && data.language === 'is') { + url = 'http://www.kefairport.is/Flugaaetlun/Komur/' + } else if (data.type === 'arrivals' && data.language === 'en') { + url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + } else { + url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + } - request.get({ - headers: { 'User-Agent': h.browser() }, - url, + request.get({ + headers: { 'User-Agent': h.browser() }, + url, }, (error, response, body) => { - if (error || response.statusCode !== 200) { - return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) - } + if (error || response.statusCode !== 200) { + return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) + } + try { + $ = cheerio.load(body) + } catch (err) { + return res.status(500).json({ error: 'Could not parse body' }) + } - try { - $ = cheerio.load(body) - } catch (err) { - return res.status(500).json({ error: 'Could not parse body' }) - } + const obj = { results: [] } - const obj = { results: [] } + $('.schedule-items-entry').each(function (key) { + if (key !== 0) { + let flight = {} + if (data.type === 'departures') { + flight = { + date: $(this).children('td').slice(0).html(), + flightNumber: $(this).children('td').slice(2).html(), + airline: $(this).children('td').slice(3).children('span').html(), + to: $(this).children('td').slice(1).children('span').html(), + plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var + realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + status: $(this).children('td').slice(4).children('span').html(), + } + } else { + flight = { + date: $(this).children('td').slice(0).html(), + flightNumber: $(this).children('td').slice(2).html(), + airline: $(this).children('td').slice(3).children('span').html(), + from: $(this).children('td').slice(1).children('span').html(), + plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var + realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + status: $(this).children('td').slice(4).children('span').html(), + } + } - $('.schedule-items-entry').each(function (key) { - if (key !== 0) { - let flight = {} - if (data.type === 'departures') { - flight = { - date: $(this).children('td').slice(0).html(), - flightNumber: $(this).children('td').slice(2).html(), - airline: $(this).children('td').slice(3).children('span').html(), - to: $(this).children('td').slice(1).children('span').html(), - plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var - realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it - status: $(this).children('td').slice(4).children('span').html(), - } - } else { - flight = { - date: $(this).children('td').slice(0).html(), - flightNumber: $(this).children('td').slice(2).html(), - airline: $(this).children('td').slice(3).children('span').html(), - from: $(this).children('td').slice(1).children('span').html(), - plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var - realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it - status: $(this).children('td').slice(4).children('span').html(), - } - } + obj.results.push(flight) + } + }) - obj.results.push(flight) - } - }) - - return res.cache(3600).json(obj) + return res.cache(3600).json(obj) }) -}) \ No newline at end of file +}) From ed4a5f35b9ddf7c178b729324cb5bd5bb8f682f9 Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Mon, 12 Nov 2018 15:52:53 +0000 Subject: [PATCH 4/9] flight-fix indentation v2 --- endpoints/flight/index.js | 83 +++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index 49b2ded7..472a2ade 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -13,60 +13,59 @@ app.get('/flight', (req, res) => { if (!data.language) data.language = '' if (data.type === 'departures' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' + url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' } else if (data.type === 'departures' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Departures/' + url = 'http://www.kefairport.is/English/Timetables/Departures/' } else if (data.type === 'arrivals' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Komur/' + url = 'http://www.kefairport.is/Flugaaetlun/Komur/' } else if (data.type === 'arrivals' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + url = 'http://www.kefairport.is/English/Timetables/Arrivals/' } else { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + url = 'http://www.kefairport.is/English/Timetables/Arrivals/' } request.get({ headers: { 'User-Agent': h.browser() }, url, - }, (error, response, body) => { - if (error || response.statusCode !== 200) { - return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) - } - try { - $ = cheerio.load(body) - } catch (err) { - return res.status(500).json({ error: 'Could not parse body' }) - } - - const obj = { results: [] } + }, (error, response, body) => { + if (error || response.statusCode !== 200) { + return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) + } + try { + $ = cheerio.load(body) + } catch (err) { + return res.status(500).json({ error: 'Could not parse body' }) + } - $('.schedule-items-entry').each(function (key) { - if (key !== 0) { - let flight = {} - if (data.type === 'departures') { - flight = { - date: $(this).children('td').slice(0).html(), - flightNumber: $(this).children('td').slice(2).html(), - airline: $(this).children('td').slice(3).children('span').html(), - to: $(this).children('td').slice(1).children('span').html(), - plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var - realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it - status: $(this).children('td').slice(4).children('span').html(), - } - } else { - flight = { - date: $(this).children('td').slice(0).html(), - flightNumber: $(this).children('td').slice(2).html(), - airline: $(this).children('td').slice(3).children('span').html(), - from: $(this).children('td').slice(1).children('span').html(), - plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var - realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it - status: $(this).children('td').slice(4).children('span').html(), - } - } + const obj = { results: [] } - obj.results.push(flight) + $('.schedule-items-entry').each(function (key) { + if (key !== 0) { + let flight = {} + if (data.type === 'departures') { + flight = { + date: $(this).children('td').slice(0).html(), + flightNumber: $(this).children('td').slice(2).html(), + airline: $(this).children('td').slice(3).children('span').html(), + to: $(this).children('td').slice(1).children('span').html(), + plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var + realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + status: $(this).children('td').slice(4).children('span').html(), } - }) + } else { + flight = { + date: $(this).children('td').slice(0).html(), + flightNumber: $(this).children('td').slice(2).html(), + airline: $(this).children('td').slice(3).children('span').html(), + from: $(this).children('td').slice(1).children('span').html(), + plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var + realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + status: $(this).children('td').slice(4).children('span').html(), + } + } + obj.results.push(flight) + } + }) return res.cache(3600).json(obj) }) From 4d22a351f335f5c87ccda0cf5adbfc1df34f6317 Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Mon, 12 Nov 2018 15:54:23 +0000 Subject: [PATCH 5/9] flight-fix final --- endpoints/flight/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index 472a2ade..4ef29f9c 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -68,5 +68,5 @@ app.get('/flight', (req, res) => { }) return res.cache(3600).json(obj) - }) + }) }) From 48ae9b65824b3b96d0ed74f29e208b44f52114b9 Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Mon, 12 Nov 2018 16:04:52 +0000 Subject: [PATCH 6/9] flight-fix -> link-fix --- endpoints/flight/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index 4ef29f9c..acc97939 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -13,15 +13,15 @@ app.get('/flight', (req, res) => { if (!data.language) data.language = '' if (data.type === 'departures' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Brottfarir/' + url = 'https://www.isavia.is/keflavikurflugvollur/flugaaetlun/brottfarir' } else if (data.type === 'departures' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Departures/' + url = 'https://www.isavia.is/en/keflavik-airport/flight-schedule/departures' } else if (data.type === 'arrivals' && data.language === 'is') { - url = 'http://www.kefairport.is/Flugaaetlun/Komur/' + url = 'https://www.isavia.is/keflavikurflugvollur/flugaaetlun/komur' } else if (data.type === 'arrivals' && data.language === 'en') { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + url = 'https://www.isavia.is/en/keflavik-airport/flight-schedule/arrivals' } else { - url = 'http://www.kefairport.is/English/Timetables/Arrivals/' + url = 'https://www.isavia.is/en/keflavik-airport/flight-schedule/arrivals' } request.get({ @@ -29,7 +29,7 @@ app.get('/flight', (req, res) => { url, }, (error, response, body) => { if (error || response.statusCode !== 200) { - return res.status(500).json({ error: 'www.kefairport.is refuses to respond or give back data' }) + return res.status(500).json({ error: 'www.isavia.is refuses to respond or give back data' }) } try { $ = cheerio.load(body) @@ -63,6 +63,7 @@ app.get('/flight', (req, res) => { status: $(this).children('td').slice(4).children('span').html(), } } + obj.results.push(flight) } }) From a32cc1d802ba5a85e3eca1a3a3d962150d7da82a Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Tue, 13 Nov 2018 13:37:19 +0000 Subject: [PATCH 7/9] flight-fix redundancy I've changed the real arrival data to output the same as now ('\r\n'). Changed planned arrival to output time from the status data. -> if there is no data it will be sent as unidentified --- endpoints/flight/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index acc97939..24ba8d9a 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -48,8 +48,8 @@ app.get('/flight', (req, res) => { flightNumber: $(this).children('td').slice(2).html(), airline: $(this).children('td').slice(3).children('span').html(), to: $(this).children('td').slice(1).children('span').html(), - plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var - realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + plannedArrival: $(this).children('td').slice(4).children('span').html().split(' ')[1], // Status contains data for plannedArrival now, consider deleting this var + realArrival: '\r\n', // There is not var on website named realArrival anymore, consider deleting it status: $(this).children('td').slice(4).children('span').html(), } } else { @@ -58,8 +58,8 @@ app.get('/flight', (req, res) => { flightNumber: $(this).children('td').slice(2).html(), airline: $(this).children('td').slice(3).children('span').html(), from: $(this).children('td').slice(1).children('span').html(), - plannedArrival: 'not available', // Status contains data for plannedArrival now, consider deleting this var - realArrival: 'not available', // There is not var on website named realArrival anymore, consider deleting it + plannedArrival: $(this).children('td').slice(4).children('span').html().split(' ')[1], // Status contains data for plannedArrival now, consider deleting this var + realArrival: '\r\n', // There is not var on website named realArrival anymore, consider deleting it status: $(this).children('td').slice(4).children('span').html(), } } From e2a313c1df8f8e3e993e22c6328328dcddee77b9 Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Tue, 13 Nov 2018 13:39:28 +0000 Subject: [PATCH 8/9] Add files via upload --- endpoints/flight/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index 24ba8d9a..5be1ac0a 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -48,7 +48,7 @@ app.get('/flight', (req, res) => { flightNumber: $(this).children('td').slice(2).html(), airline: $(this).children('td').slice(3).children('span').html(), to: $(this).children('td').slice(1).children('span').html(), - plannedArrival: $(this).children('td').slice(4).children('span').html().split(' ')[1], // Status contains data for plannedArrival now, consider deleting this var + plannedArrival: $(this).children('td').slice(4).children('span').html().split(' ')[1], // Status contains data for plannedArrival now, consider deleting this var realArrival: '\r\n', // There is not var on website named realArrival anymore, consider deleting it status: $(this).children('td').slice(4).children('span').html(), } @@ -58,7 +58,7 @@ app.get('/flight', (req, res) => { flightNumber: $(this).children('td').slice(2).html(), airline: $(this).children('td').slice(3).children('span').html(), from: $(this).children('td').slice(1).children('span').html(), - plannedArrival: $(this).children('td').slice(4).children('span').html().split(' ')[1], // Status contains data for plannedArrival now, consider deleting this var + plannedArrival: $(this).children('td').slice(4).children('span').html().split(' ')[1], // Status contains data for plannedArrival now, consider deleting this var realArrival: '\r\n', // There is not var on website named realArrival anymore, consider deleting it status: $(this).children('td').slice(4).children('span').html(), } From 5514e4f426de2030ecb0c347eef9e19fe281cba0 Mon Sep 17 00:00:00 2001 From: Kacper Z Date: Tue, 13 Nov 2018 13:42:46 +0000 Subject: [PATCH 9/9] flight-fix CircleCi didn't really like the change(as sometimes the data may be unidentified), so now the planned arrival return the same data as status. --- endpoints/flight/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/endpoints/flight/index.js b/endpoints/flight/index.js index 5be1ac0a..2a3f151c 100644 --- a/endpoints/flight/index.js +++ b/endpoints/flight/index.js @@ -48,7 +48,7 @@ app.get('/flight', (req, res) => { flightNumber: $(this).children('td').slice(2).html(), airline: $(this).children('td').slice(3).children('span').html(), to: $(this).children('td').slice(1).children('span').html(), - plannedArrival: $(this).children('td').slice(4).children('span').html().split(' ')[1], // Status contains data for plannedArrival now, consider deleting this var + plannedArrival: $(this).children('td').slice(4).children('span').html(), // Status contains data for plannedArrival now, consider deleting this var realArrival: '\r\n', // There is not var on website named realArrival anymore, consider deleting it status: $(this).children('td').slice(4).children('span').html(), } @@ -58,7 +58,7 @@ app.get('/flight', (req, res) => { flightNumber: $(this).children('td').slice(2).html(), airline: $(this).children('td').slice(3).children('span').html(), from: $(this).children('td').slice(1).children('span').html(), - plannedArrival: $(this).children('td').slice(4).children('span').html().split(' ')[1], // Status contains data for plannedArrival now, consider deleting this var + plannedArrival: $(this).children('td').slice(4).children('span').html(), // Status contains data for plannedArrival now, consider deleting this var realArrival: '\r\n', // There is not var on website named realArrival anymore, consider deleting it status: $(this).children('td').slice(4).children('span').html(), }