fix: parse CRN ETA as value plus unit
This commit is contained in:
@@ -12,13 +12,19 @@
|
|||||||
## Hypotheses & Verification
|
## Hypotheses & Verification
|
||||||
| ID | Hypothesis | Likelihood | Effort | Evidence |
|
| ID | Hypothesis | Likelihood | Effort | Evidence |
|
||||||
|----|------------|------------|--------|----------|
|
|----|------------|------------|--------|----------|
|
||||||
| A | NBT 侧生成的 `announceKey` 仍未与 `create_target` 文本键完全匹配,导致没有走文本 ETA 覆盖 | High | Low | Pending |
|
| A | NBT 侧生成的 `announceKey` 仍未与 `create_target` 文本键完全匹配,导致没有走文本 ETA 覆盖 | High | Low | Rejected |
|
||||||
| B | `create_target` 文本里解析出的 ETA 本身就是“到发后/含停站”的字段,而不是进站前 ETA | Medium | Low | Pending |
|
| B | `create_target` 文本里解析出的 ETA 本身就是“到发后/含停站”的字段,而不是进站前 ETA | Medium | Low | Inconclusive |
|
||||||
| C | 文本解析到了正确 ETA,但后来又被 NBT 计算值覆盖 | Medium | Low | Pending |
|
| C | 文本解析到了正确 ETA,但后来又被 NBT 计算值覆盖 | Medium | Low | Rejected |
|
||||||
| D | 同一班车在 NBT 与文本中的目的地/车次格式仍有额外差异(空格、平台、后缀) | High | Low | Pending |
|
| D | 同一班车在 NBT 与文本中的目的地/车次格式仍有额外差异(空格、平台、后缀) | High | Low | Rejected |
|
||||||
|
| E | `create_target` 文本切分错位,把 ETA 数值丢掉了,只留下中文单位(在 CC 中显示为 `??`) | High | Low | Confirmed |
|
||||||
|
|
||||||
## Log Evidence
|
## Log Evidence
|
||||||
- Pending instrumentation
|
- 屏幕证据:`TK:[Local]1123_HC-02 2`
|
||||||
|
- 屏幕证据:`NK:[Local]1123_HC-02 2`
|
||||||
|
- 屏幕证据:`TXT:-1 NBT:113 USE:113`
|
||||||
|
- 屏幕证据:`ETASTR:??`
|
||||||
|
- 结论:文本键已匹配成功,但 `etaStr` 仅剩单位文本,数值部分在切分时被错误丢弃。
|
||||||
|
|
||||||
## Verification Conclusion
|
## Verification Conclusion
|
||||||
- Pending
|
- 根因已确认:`create_target` 文本解析错误地将第一段数字当成独立字段丢掉,导致 ETA 解析只看到中文单位。
|
||||||
|
- 下一步修复:改为将 ETA 解析为“数值 + 单位”的组合字符串,再交给 `parseEtaText()`。
|
||||||
|
|||||||
@@ -2428,15 +2428,16 @@ function Main.loop()
|
|||||||
for _, lineText in pairs(lines) do
|
for _, lineText in pairs(lines) do
|
||||||
if lineText and lineText ~= "" and lineText:match("[%w%?%[]") then
|
if lineText and lineText ~= "" and lineText:match("[%w%?%[]") then
|
||||||
local cleanLine = string.gsub(lineText, "%s*%(?%+%s*%d+.-%)?", "")
|
local cleanLine = string.gsub(lineText, "%s*%(?%+%s*%d+.-%)?", "")
|
||||||
local platform, etaStr, tName, dest
|
local etaValue, etaUnit, tName, dest
|
||||||
platform, etaStr, tName, dest = string.match(cleanLine, "^(%d+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$")
|
etaValue, etaUnit, tName, dest = string.match(cleanLine, "^(%S+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$")
|
||||||
if not tName then
|
if not tName then
|
||||||
platform, etaStr, tName, dest = string.match(cleanLine, "^([^%s]+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$")
|
etaValue, etaUnit, tName, dest = string.match(cleanLine, "^([^%s]+)%s+(.-)%s+([^%s]+)%s+(.*)$")
|
||||||
end
|
end
|
||||||
if not tName then
|
if tName and etaValue then
|
||||||
platform, etaStr, tName, dest = string.match(cleanLine, "^([^%s]+)%s+(.-)%s+([^%s]+)%s+(.*)$")
|
local etaStr = tostring(etaValue or "")
|
||||||
end
|
if etaUnit and etaUnit ~= "" then
|
||||||
if tName and etaStr then
|
etaStr = etaStr .. " " .. tostring(etaUnit)
|
||||||
|
end
|
||||||
local etaSeconds = parseEtaText(etaStr)
|
local etaSeconds = parseEtaText(etaStr)
|
||||||
if dest then
|
if dest then
|
||||||
local textKey = tName .. "_" .. dest
|
local textKey = tName .. "_" .. dest
|
||||||
|
|||||||
Reference in New Issue
Block a user