Skip to main content
After a student completes one or more lesson attempts, you can retrieve their history and review per-question results. This is useful for building review screens, progress dashboards, or retry flows.

List past attempts

Call lessons.attempts() to get all attempts for a lesson:
const attempts = await timeback.lessons.attempts({
	lessonId: lesson.id,
})
Each attempt includes attempt number, score, finalized status, totalQuestions, and correctQuestions.
See the reference for the full return type.

Get attempt details

To see per-question data for a specific attempt, call lessons.attemptDetails():
const details = await timeback.lessons.attemptDetails({
	lessonId: lesson.id,
	attempt: 1,
})

Extract questions

Use getLessonAttemptQuestions() to get a flat list of questions from the response:
import { getLessonAttemptQuestions } from '@timeback/sdk'

const questions = getLessonAttemptQuestions(details)
Each question includes id, correct, studentResponse, and content.rawXml for re-rendering.
See the reference for full type documentation.
The raw response shape differs by lesson type. Adaptive lessons (powerpath-100) return seenQuestions, which is only the questions PowerPath actually served (the count varies per student). Linear lessons (quiz, test-out, etc.) return questions, which is the full fixed set for the attempt.getLessonAttemptQuestions() normalizes both into a single LessonAttemptQuestion[]. If you need to distinguish the two (e.g., to show “X of Y questions seen” for adaptive lessons), check details.lessonType and access the raw fields directly.

Build a review screen

A typical review flow:
// 1. Load attempts
const attempts = await timeback.lessons.attempts({ lessonId })

// 2. Let the student pick an attempt to review
const selected = attempts[0]

// 3. Load details
const details = await timeback.lessons.attemptDetails({
	lessonId,
	attempt: selected.attempt,
})

// 4. Get questions
const questions = getLessonAttemptQuestions(details)

// 5. Render review cards
for (const q of questions) {
	renderReviewCard({
		questionXml: q.content.rawXml,
		studentAnswer: q.studentResponse,
		wasCorrect: q.correct,
	})
}

Next steps

Lesson discovery

Start a new lesson

Reference

Parameters, properties, methods, and return types