Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/org/mtransit/commons/FeatureFlags.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ object FeatureFlags {
// const val F_EXPORT_DIRECTION_STOP_LAST = false
const val F_EXPORT_DIRECTION_STOP_LAST = true

const val F_EXPORT_STOP_TIMEZONE_ID = false
// const val F_EXPORT_STOP_TIMEZONE_ID = true

// @formatter:on
}
7 changes: 7 additions & 0 deletions src/main/java/org/mtransit/commons/GTFSCommons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ object GTFSCommons {
const val T_STOP_K_LNG = "lng"
const val T_STOP_K_ACCESSIBLE = "a11y"
const val T_STOP_K_ORIGINAL_ID_HASH = "o_id_hash"
const val T_STOP_K_TIMEZONE_ID = "tz"

@JvmField
val T_STOP_STRINGS_COLUMN_IDX = intArrayOf(2)
Expand All @@ -187,6 +188,9 @@ object GTFSCommons {
appendColumn(T_STOP_K_LNG, SQLUtils.REAL)
appendColumn(T_STOP_K_ACCESSIBLE, SQLUtils.INT)
appendColumn(T_STOP_K_ORIGINAL_ID_HASH, SQLUtils.INT)
if (FeatureFlags.F_EXPORT_STOP_TIMEZONE_ID) {
appendColumn(T_STOP_K_TIMEZONE_ID, SQLUtils.TXT)
}
}.build()

@JvmStatic
Expand All @@ -198,6 +202,9 @@ object GTFSCommons {
appendColumn(T_STOP_K_LNG)
appendColumn(T_STOP_K_ACCESSIBLE)
appendColumn(T_STOP_K_ORIGINAL_ID_HASH)
if (FeatureFlags.F_EXPORT_STOP_TIMEZONE_ID) {
appendColumn(T_STOP_K_TIMEZONE_ID)
}
}.build()

@JvmStatic
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/mtransit/commons/gtfs/data/Stop.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data class Stop(
val stopUrl: Url?,
val locationType: Int?, // TODO Enum
val parentStationId: StopId?,
// stop_timezone
val stopTimezone: String?,
val wheelchairBoarding: Int?, // TODO Enum 0 1 2
// level_id
// val platformCode: Text?, // TODO useful!
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/mtransit/commons/gtfs/sql/StopSQL.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ object StopSQL : CommonSQL<Stop>(), TableSQL {
const val T_STOP_K_STOP_URL = "stop_url"
const val T_STOP_K_LOCATION_TYPE = "location_type"
const val T_STOP_K_PARENT_STATION_ID_INT = "parent_station_id_int"
const val T_STOP_K_STOP_TIMEZONE = "stop_timezone"
const val T_STOP_K_WHEELCHAIR_BOARDING = "wheelchair_boarding"

override fun getMainTable() = SQLTableDef(
Expand All @@ -53,6 +54,7 @@ object StopSQL : CommonSQL<Stop>(), TableSQL {
SQLColumDef(T_STOP_K_STOP_URL, SQLUtils.TXT),
SQLColumDef(T_STOP_K_LOCATION_TYPE, SQLUtils.INT),
SQLColumDef(T_STOP_K_PARENT_STATION_ID_INT, SQLUtils.INT, foreignKey = SQLForeignKey(T_STOP_IDS, T_STOP_IDS_K_ID_INT)),
SQLColumDef(T_STOP_K_STOP_TIMEZONE, SQLUtils.TXT),
SQLColumDef(T_STOP_K_WHEELCHAIR_BOARDING, SQLUtils.INT),
),
insertAllowReplace = false,
Expand All @@ -68,6 +70,7 @@ object StopSQL : CommonSQL<Stop>(), TableSQL {
stopUrl?.quotesEscape(),
locationType,
parentStationId?.let { getOrInsertIdInt(statement, it) },
stopTimezone?.quotesEscape(),
wheelchairBoarding,
)
}
Expand Down Expand Up @@ -105,6 +108,7 @@ object StopSQL : CommonSQL<Stop>(), TableSQL {
stopUrl = getString(T_STOP_K_STOP_URL),
locationType = getInt(T_STOP_K_LOCATION_TYPE),
parentStationId = getString(getAlias(T_STOP_K_PARENT_STATION_ID_INT, T_STOP_IDS_K_ID)),
stopTimezone = getString(T_STOP_K_STOP_TIMEZONE),
wheelchairBoarding = getInt(T_STOP_K_WHEELCHAIR_BOARDING),
)
}
Expand Down
Loading