Restructurate GTFS feeds into dedicated models

This commit is contained in:
2024-05-09 19:28:19 +02:00
parent 820fc0cc19
commit 11949228ee
11 changed files with 1594 additions and 950 deletions

View File

@@ -40,23 +40,23 @@ function AutocompleteStop(params) {
}
function getOptionGroup(option) {
switch (option.transport_type) {
case "TGV":
case "IC":
case "TER":
switch (option.gtfs_feed) {
case "FR-SNCF-TGV":
case "FR-SNCF-IC":
case "FR-SNCF-TER":
return "TGV/TER/Intercités"
case "TN":
case "FR-IDF-TN":
return "Transilien"
case "ES":
case "FR-EUROSTAR":
return "Eurostar"
case "TI":
case "IT-FRA-TI":
return "Trenitalia France"
case "RENFE":
case "ES-RENFE":
return "RENFE"
case "OBB":
case "AT-OBB":
return "ÖBB"
default:
return option.transport_type
return option.gtfs_feed
}
}

View File

@@ -229,10 +229,10 @@ function TrainRow({train, tableType, date, time}) {
}
function getTrainType(train, trip, route) {
switch (route.transport_type) {
case "TGV":
case "TER":
case "IC":
switch (route.gtfs_feed) {
case "FR-SNCF-TGV":
case "FR-SNCF-IC":
case "FR-SNCF-TER":
let trainType = train.stop.split("StopPoint:OCE")[1].split("-")[0]
switch (trainType) {
case "Train TER":
@@ -244,20 +244,20 @@ function getTrainType(train, trip, route) {
default:
return trainType
}
case "TN":
case "FR-IDF-TN":
return route.short_name
case "ES":
case "FR-EUROSTAR":
return "Eurostar"
case "TI":
return "Trenitalia"
case "RENFE":
case "IT-FRA-TI":
return "Trenitalia France"
case "ES-RENFE":
return "RENFE"
case "OBB":
if (trip.short_name.startsWith("NJ"))
case "AT-OBB":
if (trip.short_name?.startsWith("NJ"))
return "NJ"
return "ÖBB"
default:
return ""
return trip.short_name?.split(" ")[0]
}
}
@@ -280,6 +280,7 @@ function getTrainTypeDisplay(trainType) {
case "Eurostar":
return <img src="/eurostar_mini.svg" alt="Eurostar" width="80%" />
case "Trenitalia":
case "Trenitalia France":
return <img src="/trenitalia.svg" alt="Frecciarossa" width="80%" />
case "RENFE":
return <img src="/renfe.svg" alt="RENFE" width="80%" />