flightplan-tool / flightplan

Search for award inventory using Node.js and Headless Chrome!
Apache License 2.0
140 stars 41 forks source link

SQ Error searching 3pax #32

Closed ferni7 closed 5 years ago

ferni7 commented 5 years ago

flightplan search -w SQ -f MEL -t SIN -c business -s 2019-01-15 -e 2019-12-31 -q 3 -h ... [SQ] DEPARTURE [MEL -> SIN] - 2019-06-02 (3 Passengers) [SQ] ARRIVAL [SIN -> MEL] - 2019-06-05 [SQ] error Unexpected error occurred while parsing! Error: Invalid award mileageCost: 38666.666666666664 at new Award (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/Award.js:54:13) at module.exports.parseAward (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:204:14) at Node.rows.each (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:148:31) at initialize.exports.each (/usr/local/share/.config/yarn/global/node_modules/cheerio/lib/api/traversing.js:300:24) at module.exports.parseFlights (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:72:10) at module.exports.parseResults (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:54:28) at module.exports.parse (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:30:15) at Results._parseAwards (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/Results.js:249:20) at Results.get awards [as awards] (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/Results.js:221:12) at main (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/bin/cli-search.js:382:28) [SQ] DEPARTURE [MEL -> SIN] - 2019-06-03 (3 Passengers) [SQ] ARRIVAL [SIN -> MEL] - 2019-06-06 [SQ] error Unexpected error occurred while parsing! Error: Invalid award mileageCost: 38666.666666666664 at new Award (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/Award.js:54:13) at module.exports.parseAward (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:204:14) at Node.rows.each (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:148:31) at initialize.exports.each (/usr/local/share/.config/yarn/global/node_modules/cheerio/lib/api/traversing.js:300:24) at module.exports.parseFlights (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:72:10) at module.exports.parseResults (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:54:28) at module.exports.parse (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/engines/sq/parser.js:30:15) at Results._parseAwards (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/Results.js:249:20) at Results.get awards [as awards] (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/src/Results.js:221:12) at main (/usr/local/share/.config/yarn/global/node_modules/flightplan-tool/bin/cli-search.js:382:28) [SQ] DEPARTURE [MEL -> SIN] - 2019-06-04 (3 Passengers)

jd20 commented 5 years ago

Interesting... SQ parser is dividing the total mileage by passenger quantity (3 in this case) to get the "per passenger" mileage, but based on those numbers it seems the value it's being passed is already per-passenger. I'll remove the division operation.

jd20 commented 5 years ago

Fixed in 0.3.48.