session.complete() to finalize the lesson. This triggers server-side scoring, flushes the final time tracking data, and returns a comprehensive result object.
Complete a lesson
score, accuracy, totalQuestions, correctQuestions, timeSpentSeconds, and more.
See the reference for the full return type.
What happens under the hood
session.complete() does three things in sequence:
- Server: calls PowerPath
finalStudentAssessmentResponse()to lock in the score, calculate XP, and update the gradebook - Client: calls
activity.end()to flush the final time tracking window as aTimeSpentEvent - Client: returns a merged result combining the server response with client-side timing data
Caliper event flow
Managed Lessons split Caliper responsibility between the SDK and PowerPath:| Concern | Handled by | Event |
|---|---|---|
| Time tracking | SDK (automatic) | TimeSpentEvent heartbeats throughout the session |
| Completion + XP | PowerPath (server-side) | ActivityEvent with calculated XP |
ActivityCompletedEvent for Managed Lessons. PowerPath is the source of truth for scoring, XP calculation, and OneRoster gradebook updates.
This means you do not need to calculate XP or report completion metrics yourself — PowerPath handles it when session.complete() calls the finalization endpoint.
Handle time tracking errors
The final time flush can fail independently of the lesson completion. When this happens, the result still contains valid scoring data, buttimeTrackingSent will be false:
Render results
Use the completion result to build a results screen:Next steps
Attempt history
Review past attempts and per-question data
Reference
Parameters, properties, methods, and return types