Fixed issue with schedule name parsing, try number 2

This commit is contained in:
Bram van der Veen 2015-08-15 17:00:27 +02:00
parent 125ec56abf
commit 3e8f58b4b1

View file

@ -13,7 +13,7 @@ function get(req, res, next) {
} }
function api(lookup, callback) { function api(lookup, callback) {
get_schedule(lookup.data[0].url, callback) get_schedule(lookup.data[0].url, callback);
} }
//Function for getting the page via http. //Function for getting the page via http.
@ -41,11 +41,11 @@ function schedule_types(page) {
var types = []; var types = [];
for (element of extract) { for (element of extract) {
element != '' ? types.push({ element != '' ? types.push({
'letter': element.substr(0, 1), 'letter': element.substr(0, 1),
'value' : element.match(/.*rooster|t\/m|\d\d\s\w{3}/g).join(' ').slice(1), 'value' : element.match(/.*rooster|t\/m|\d\d\s\w{3}/gi).join(' ').slice(1).toLowerCase(),
'tab': tab++ 'tab': tab++
}) : null; }) : null;
} }
return types; return types;