diff --git a/CHANGELOG.md b/CHANGELOG.md index 0175be7..0c4b105 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ## 使用建议 diff --git a/README.md b/README.md index 6adf776..d1c15eb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Dota 2 Calendar Sync v3.7 +# Dota 2 Calendar Sync v3.8 自动从 Liquipedia 获取 Dota 2 Tier 1 比赛信息并同步到 Google Calendar,支持自动更新比赛结果、时间变更、智能管理TBD占位事件和自动清理重复比赛。 diff --git a/sync_dota2_matches.py b/sync_dota2_matches.py index 6c0456d..c9f4479 100644 --- a/sync_dota2_matches.py +++ b/sync_dota2_matches.py @@ -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,10 +661,13 @@ 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 - score = match_data.get('score', '?-?') - summary = f"✓ {score} {summary}" + # 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}" # Update the event event['description'] = description