The frontend plays node quizzes, but a node only completed once every one of its
8-13 lessons was completed separately, so students were stuck after the first
island of each unit. POST /api/nodes/{id}/quiz/complete now completes the node
(any score; score only sets stars/xp) and returns nextNodeId.
Also closes the other backend gaps found while auditing the frontend:
- /api/ai/ask without lessonId now picks the book from the user's grade instead
of skipping retrieval, so the "ask Pi" tab is grounded in the textbook.
- guest sessions return a refreshToken; they used to go silently 401 after 1h.
- lesson_complete throttle 10/hour -> 120/hour (a lesson here is 1-2 questions).
- progressPercent is per grade, not over all 2,617 lessons of every grade.
- a one-year plan (299,000 toman) is created by migration when no plan exists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
from django.urls import path
|
|
|
|
from .views import (
|
|
GradesListView,
|
|
HomeView,
|
|
LessonCompleteView,
|
|
LessonIntroView,
|
|
LessonQuestionsView,
|
|
NodeLessonsView,
|
|
NodeQuizCompleteView,
|
|
NodeQuizView,
|
|
NodeProgressListView,
|
|
QuestionAnswerView,
|
|
QuestionReportView,
|
|
)
|
|
|
|
urlpatterns = [
|
|
path('grades', GradesListView.as_view(), name='grades-list'),
|
|
path('home', HomeView.as_view(), name='home'),
|
|
path('lessons/<int:lesson_id>/intro', LessonIntroView.as_view(), name='lesson-intro'),
|
|
path('lessons/<int:lesson_id>/questions', LessonQuestionsView.as_view(), name='lesson-questions'),
|
|
path('lessons/<int:lesson_id>/complete', LessonCompleteView.as_view(), name='lesson-complete'),
|
|
path('questions/<int:question_id>/answer', QuestionAnswerView.as_view(), name='question-answer'),
|
|
path('questions/<int:question_id>/report', QuestionReportView.as_view(), name='question-report'),
|
|
path('nodes/<int:node_id>/lessons', NodeLessonsView.as_view(), name='node-lessons'),
|
|
path('nodes/<int:node_id>/quiz', NodeQuizView.as_view(), name='node-quiz'),
|
|
path('nodes/<int:node_id>/quiz/complete', NodeQuizCompleteView.as_view(), name='node-quiz-complete'),
|
|
path('progress/nodes', NodeProgressListView.as_view(), name='node-progress-list'),
|
|
]
|