fix: 修复标题多重比分累积问题 v4.3
All checks were successful
continuous-integration/drone/push Build is passing

- 修复 update_event_with_score() 和 update_event_with_result() 的比分清理逻辑
- 解决了标题中比分不断累积的问题(如 "✓ 2-0 1-0")
- 改进正则表达式,现在能清理所有位置的比分
- 手动修复了9个历史事件的标题

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ching L 2025-09-13 10:22:05 +08:00
parent dc2a4c0279
commit d01c6aab85
3 changed files with 26 additions and 5 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## v4.3 - 2025-09-13 - 修复标题多重比分问题
- **🐛 修复多重比分累积问题**
- 修复了 `update_event_with_score()``update_event_with_result()` 方法中的比分清理逻辑
- 原问题:正则表达式 `^(\d+[-:]\d+\s+)+` 无法匹配带有 `✓` 标记的标题,导致比分不断累积
- 现在使用 `\d+-\d+\s+` 清理所有比分,不限于开头位置
- 修复了9个历史事件的标题如 "✓ 2-0 1-0" 改为 "✓ 2-0"
## v4.2 - 2025-09-13 - 智能合并重复比赛
- **🔀 智能合并重复比赛**
- 新增 `_merge_duplicate_matches()` 方法

View File

@ -1,9 +1,14 @@
# Dota 2 Calendar Sync v4.2
# Dota 2 Calendar Sync v4.3
自动从 Liquipedia 获取 Dota 2 Tier 1 比赛信息并同步到 Google Calendar支持自动更新比赛结果、时间变更、智能管理TBD占位事件、自动清理过期和重复比赛。
## 更新日志
### v4.3 (2025-09-13)
- 🐛 修复多重比分累积:解决了标题中出现多个比分的问题(如 "✓ 2-0 1-0"
- 🔧 改进比分清理逻辑:现在能正确清理所有位置的比分,不只是开头
- ✅ 修复了9个历史事件的标题格式
### v4.2 (2025-09-13)
- 🔀 智能合并重复比赛:自动检测同时间具有共同队伍的比赛并合并(处理队伍名称变体)
- 📝 队伍名称标准化:当发现 "OG" 和 "OG Esports" 这样的变体时,保留更长的完整名称

View File

@ -998,9 +998,13 @@ class Dota2CalendarSync:
else:
description += f"\n{score_text}"
# Update summary
# Update summary - remove ALL existing scores first
summary = event.get('summary', '')
summary = re.sub(r'^(\d+[-:]\d+\s+)+', '', summary)
# Remove all score patterns (including those after checkmark)
summary = re.sub(r'\d+-\d+\s+', '', summary)
# Clean up extra spaces
summary = ' '.join(summary.split())
# Add new score at the beginning
summary = f"{match.score} {summary}"
event['description'] = description
@ -1056,10 +1060,15 @@ class Dota2CalendarSync:
else:
description += f"\n{result_text}"
# Update summary
# Update summary - remove ALL existing scores and checkmarks first
summary = event.get('summary', '')
summary = re.sub(r'^(\d+[-:]\d+\s+)+', '', summary)
# Remove all score patterns
summary = re.sub(r'\d+-\d+\s+', '', summary)
# Remove checkmark if present
summary = re.sub(r'^✓\s+', '', summary)
# Clean up extra spaces
summary = ' '.join(summary.split())
# Add checkmark and final score
summary = f"{match.score} {summary}"
event['description'] = description