1
0

Add train id to data

This commit is contained in:
clerie 2020-09-19 23:06:19 +02:00
parent efec9271c3
commit 5c89d26691

View File

@ -193,6 +193,7 @@ var connection_result_observer = new MutationObserver((mutations) => {
// Prodcut details
data[i]["products"][j]["product"] = null;
data[i]["products"][j]["train_id"] = null;
data[i]["products"][j]["train_number"] = null;
data[i]["products"][j]["line_name"] = null;
@ -201,14 +202,15 @@ var connection_result_observer = new MutationObserver((mutations) => {
// Product name in format "STB 12 (23561)"
if(name_list.length == 3 && name_list[2].charAt(0) == '(' && name_list[2].charAt(name_list[2].length-1) == ')') {
data[i]["products"][j]["product"] = name_list[0];
data[i]["products"][j]["train_number"] = name_list[0] + " " + name_list[2].substring(1, name_list[2].length-1);
data[i]["products"][j]["train_id"] = name_list[2].substring(1, name_list[2].length-1)
data[i]["products"][j]["line_name"] = name_list[0] + " " + name_list[1];
}
// Product name in format "ICE 234"
else {
data[i]["products"][j]["product"] = name_list[0];
data[i]["products"][j]["train_number"] = name_list[0] + " " + name_list[1];
data[i]["products"][j]["train_id"] = name_list[1];
}
data[i]["products"][j]["train_number"] = data[i]["products"][j]["product"] + " " + data[i]["products"][j]["train_id"];
});
// Travel information