DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix(H2): deduplicate error records, use RetryAttempt, graduate on correct answer
unknown7af85c57814a
diff --git a/deeptutor/learning/service.py b/deeptutor/learning/service.pyindex 9926d45af..ed893dbf6 100644--- a/deeptutor/learning/service.py+++ b/deeptutor/learning/service.py@@ -9,6 +9,7 @@ from deeptutor.learning.models import (LearningProgress,LearningStage,QuizAttempt,+ RetryAttempt,)from deeptutor.learning.storage import LearningStore@@ -40,17 +41,55 @@ class LearningService:def record_quiz_attempt(self, progress: LearningProgress, attempt: QuizAttempt) -> None:+ key = (attempt.question_id, attempt.knowledge_point_id)+if not attempt.is_correct and attempt.error_type is not None:- record = ErrorRecord(- id=uuid.uuid4().hex,- question_id=attempt.question_id,- knowledge_point_id=attempt.knowledge_point_id,- module_id=attempt.module_id,- error_type=attempt.error_type,- self_attribution=attempt.self_attribution,- status="active",- )- progress.error_records.append(record)+ # Find existing error record for this question + knowledge point.+ existing = None+ for rec in progress.error_records:+ if rec.question_id == attempt.question_id and rec.knowledge_point_id == attempt.knowledge_point_id:+ existing = rec+ break++ if existing is not None:+ existing.retry_history.append(+ RetryAttempt(+ timestamp=time.time(),+ is_correct=False,+ attempt_number=len(existing.retry_history) + 1,+ )+ )+ existing.status = "retrying"+ else:+ record = ErrorRecord(+ id=uuid.uuid4().hex,+ question_id=attempt.question_id,+ knowledge_point_id=attempt.knowledge_point_id,+ module_id=attempt.module_id,+ error_type=attempt.error_type,+ self_attribution=attempt.self_attribution,+ status="active",+ )+ progress.error_records.append(record)++ elif attempt.is_correct:+ # Graduate any active error record for this question + knowledge point.+ for rec in progress.error_records:+ if (+ rec.question_id == attempt.question_id+ and rec.knowledge_point_id == attempt.knowledge_point_id+ and rec.status in ("active", "retrying")+ ):+ rec.retry_history.append(+ RetryAttempt(+ timestamp=time.time(),+ is_correct=True,+ attempt_number=len(rec.retry_history) + 1,+ )+ )+ rec.status = "graduated"+ break+progress.updated_at = time.time()def update_mastery(