修复日历事件标题中重复比分的问题 v3.8
All checks were successful
continuous-integration/drone/push Build is passing

- 修复了更新比赛比分时可能出现重复比分的bug(如 '0-2 0-1')
- 改进比分更新逻辑,确保标题中只显示一个比分
- 更新 README 和 CHANGELOG 到 v3.8

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ching L 2025-09-08 14:00:44 +08:00
parent 99ad345c36
commit 253277620c
3 changed files with 21 additions and 7 deletions

View File

@ -1,5 +1,15 @@
# Changelog
## v3.8 - 2025-09-08 - 修复重复比分显示问题
- **修复标题中重复比分的问题**
- 修复了在更新比赛比分时可能出现重复比分的bug如 "0-2 0-1"
- 改进了 `update_event_with_score` 方法,使用更强的正则表达式清理多个比分
- 改进了 `update_event_with_result` 方法,先清理所有旧比分再添加最终比分
- **增强比分更新逻辑**
- 进行中比分更新时会正确移除之前的所有比分
- 完成比赛更新时会先清理进行中的比分,再添加最终结果
- 确保标题中始终只显示一个比分
## v3.7 - 2025-09-08 - 增强重复事件处理和TBD管理
- **改进TBD比赛ID生成**
- TBD vs TBD比赛现在使用时间戳生成唯一ID避免重复创建
@ -132,6 +142,7 @@
| v3.5 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| v3.6 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| v3.7 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| v3.8 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
## 使用建议

View File

@ -1,4 +1,4 @@
# Dota 2 Calendar Sync v3.7
# Dota 2 Calendar Sync v3.8
自动从 Liquipedia 获取 Dota 2 Tier 1 比赛信息并同步到 Google Calendar支持自动更新比赛结果、时间变更、智能管理TBD占位事件和自动清理重复比赛。

View File

@ -608,8 +608,8 @@ class Dota2CalendarSync:
# Update the summary to show current score (without checkmark)
summary = event.get('summary', '')
# Remove any existing score
summary = re.sub(r'^\d+[-:]\d+\s+', '', summary)
# Remove any existing score (including multiple scores)
summary = re.sub(r'^(\d+[-:]\d+\s+)+', '', summary)
# Add new score at the beginning
score = match_data.get('score', '?-?')
summary = f"{score} {summary}"
@ -661,8 +661,11 @@ class Dota2CalendarSync:
# Update the summary to show it's completed with result
summary = event.get('summary', '')
if '' not in summary:
# Add checkmark and score right after it
# First remove any existing scores (in-progress scores)
summary = re.sub(r'^(\d+[-:]\d+\s+)+', '', summary)
# Remove any existing checkmark
summary = re.sub(r'^✓\s+', '', summary)
# Add checkmark and final score
score = match_data.get('score', '?-?')
summary = f"{score} {summary}"