Fix: correctly parse nextStation by checking both create:station and create:destination, and handle schedule loop
This commit is contained in:
+13
-2
@@ -2,7 +2,7 @@
|
|||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- 1. Configuration & Constants
|
-- 1. Configuration & Constants
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
local APP_VERSION_TEXT = "v1.0.16"
|
local APP_VERSION_TEXT = "v1.0.17"
|
||||||
|
|
||||||
local CONFIG = {
|
local CONFIG = {
|
||||||
CLOUD_URL = "ws://stabadmin.fse-media.group",
|
CLOUD_URL = "ws://stabadmin.fse-media.group",
|
||||||
@@ -897,11 +897,22 @@ function Utils.getNextStation(schedule, currentStationName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if matchFoundIndex then
|
if matchFoundIndex then
|
||||||
|
-- Search forward
|
||||||
for i = matchFoundIndex + 1, maxIdx do
|
for i = matchFoundIndex + 1, maxIdx do
|
||||||
local entry = schedule.entries[i]
|
local entry = schedule.entries[i]
|
||||||
if entry and entry.instruction then
|
if entry and entry.instruction then
|
||||||
local inst = entry.instruction
|
local inst = entry.instruction
|
||||||
if inst.id == "create:station" then
|
if inst.id == "create:station" or inst.id == "create:destination" then
|
||||||
|
return (inst.data and inst.data.text) or inst.text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Loop around to beginning
|
||||||
|
for i = 1, matchFoundIndex - 1 do
|
||||||
|
local entry = schedule.entries[i]
|
||||||
|
if entry and entry.instruction then
|
||||||
|
local inst = entry.instruction
|
||||||
|
if inst.id == "create:station" or inst.id == "create:destination" then
|
||||||
return (inst.data and inst.data.text) or inst.text
|
return (inst.data and inst.data.text) or inst.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user