Insert an execution_analyses row + its skill_judgments. Called within a transaction holding ``self._mu``. Returns: int: The ``execution_analyses.id`` of the newly inserted row.
(self, a: ExecutionAnalysis)
| 1326 | self._insert_analysis(a) |
| 1327 | |
| 1328 | def _insert_analysis(self, a: ExecutionAnalysis) -> int: |
| 1329 | """Insert an execution_analyses row + its skill_judgments. |
| 1330 | |
| 1331 | Called within a transaction holding ``self._mu``. |
| 1332 | |
| 1333 | Returns: |
| 1334 | int: The ``execution_analyses.id`` of the newly inserted row. |
| 1335 | """ |
| 1336 | cur = self._conn.execute( |
| 1337 | """ |
| 1338 | INSERT INTO execution_analyses ( |
| 1339 | task_id, timestamp, |
| 1340 | task_completed, execution_note, |
| 1341 | tool_issues, candidate_for_evolution, |
| 1342 | evolution_suggestions, analyzed_by, analyzed_at |
| 1343 | ) VALUES (?,?, ?,?, ?,?, ?,?,?) |
| 1344 | """, |
| 1345 | ( |
| 1346 | a.task_id, |
| 1347 | a.timestamp.isoformat(), |
| 1348 | int(a.task_completed), |
| 1349 | a.execution_note, |
| 1350 | json.dumps(a.tool_issues, ensure_ascii=False), |
| 1351 | int(a.candidate_for_evolution), |
| 1352 | json.dumps( |
| 1353 | [s.to_dict() for s in a.evolution_suggestions], |
| 1354 | ensure_ascii=False, |
| 1355 | ), |
| 1356 | a.analyzed_by, |
| 1357 | a.analyzed_at.isoformat(), |
| 1358 | ), |
| 1359 | ) |
| 1360 | analysis_id = cur.lastrowid |
| 1361 | |
| 1362 | for j in a.skill_judgments: |
| 1363 | self._conn.execute( |
| 1364 | "INSERT INTO skill_judgments " |
| 1365 | "(analysis_id, skill_id, skill_applied, note) " |
| 1366 | "VALUES (?,?,?,?)", |
| 1367 | (analysis_id, j.skill_id, int(j.skill_applied), j.note), |
| 1368 | ) |
| 1369 | |
| 1370 | return analysis_id |
| 1371 | |
| 1372 | # Deserialization |
| 1373 | def _to_record( |
no test coverage detected