mirror of
https://devops.liangqichi.top/qichi.liang/Orbitin.git
synced 2026-02-10 15:41:31 +08:00
fix: 修复跨分隔符班次数据解析问题(28号夜班)
This commit is contained in:
@@ -60,7 +60,27 @@ class HandoverLogParser:
|
||||
船次日志列表(已合并同日期同班次同船名的记录)
|
||||
"""
|
||||
logs = []
|
||||
blocks = text.split(self.SEPARATOR)
|
||||
|
||||
# 预处理:移除分隔符行(只保留内容分隔符,去掉单行的)
|
||||
# 分隔符应该是独立一行,且前后有内容的
|
||||
lines = text.split('\n')
|
||||
processed_lines = []
|
||||
i = 0
|
||||
while i < len(lines):
|
||||
line = lines[i]
|
||||
if line.strip() == self.SEPARATOR:
|
||||
# 检查是否是单行分隔符(前后都是分隔符或空行)
|
||||
prev_is_sep = i > 0 and lines[i-1].strip() == self.SEPARATOR
|
||||
next_is_sep = i < len(lines)-1 and lines[i+1].strip() == self.SEPARATOR
|
||||
if not (prev_is_sep and next_is_sep):
|
||||
# 单行分隔符,跳过
|
||||
i += 1
|
||||
continue
|
||||
processed_lines.append(line)
|
||||
i += 1
|
||||
|
||||
processed_text = '\n'.join(processed_lines)
|
||||
blocks = processed_text.split(self.SEPARATOR)
|
||||
|
||||
for block in blocks:
|
||||
if not block.strip() or '日期:' not in block:
|
||||
|
||||
Reference in New Issue
Block a user