feat: score实时更新#447
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the execution logic in dingo/exec/local.py to dynamically calculate and update the summary score during execution, ensuring it remains accurate if a task terminates early. The review feedback correctly points out that the conditional check self.summary.total > 0 is redundant because the total has just been incremented, and suggests simplifying the code by removing the unnecessary if-else block.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| # Keep score updated during execution so get_summary() | ||
| # remains meaningful even if the task stops early. | ||
| if self.summary.total > 0: | ||
| self.summary.score = round( | ||
| self.summary.num_good / self.summary.total * 100, 2 | ||
| ) | ||
| else: | ||
| self.summary.score = 0.0 |
There was a problem hiding this comment.
由于在前面已经执行了 self.summary.total += 1,self.summary.total 的值必然大于 0。因此,这里的 if self.summary.total > 0 判断和 else 分支是多余的,可以直接进行计算以简化代码并提高可读性。
# Keep score updated during execution so get_summary()
# remains meaningful even if the task stops early.
self.summary.score = round(
self.summary.num_good / self.summary.total * 100, 2
)
No description provided.