| 1230 | return task |
| 1231 | |
| 1232 | async def stats(self) -> Optional[Stats]: |
| 1233 | total = len(self._data_records) |
| 1234 | attempted = len(self._tasks) |
| 1235 | correct = sum(1 for r in self._tasks if r.score and r.score >= 1.0) |
| 1236 | |
| 1237 | task_times = {r.task_id: r.time for r in self._tasks if r.time is not None} |
| 1238 | avg_time = sum(task_times.values()) / len(task_times) if task_times else 0.0 |
| 1239 | |
| 1240 | return Stats( |
| 1241 | accuracy=correct / attempted if attempted > 0 else 0.0, |
| 1242 | total=total, |
| 1243 | correct=correct, |
| 1244 | wrong=attempted - correct, |
| 1245 | times=task_times, |
| 1246 | average_time=avg_time |
| 1247 | ) |
| 1248 | |
| 1249 | def _parse_result_score(self, result: Dict[str, Any]) -> float: |
| 1250 | """ |