Two approaches
You can report progress in two ways. Both are passed as part of completion metrics (client) ortimeback.activity.record() (server).
masteredUnits (recommended)
If your app tracks mastery at the lesson level, pass masteredUnits and let the server auto-compute pctComplete for you. This is the recommended approach because the server maintains a running total across all of a student’s submissions, using totalLessons — a mandatory field on every Timeback course — as the denominator.
pctComplete directly
If your app already tracks overall course progress, you can pass pctComplete (0—100) directly when ending an activity. The server forwards it as-is — no computation needed.
How masteredUnits works
masteredUnits is an incremental count; it represents how many new units (lessons) a student mastered during this specific activity, not a cumulative total.
What the server does
WhenmasteredUnits is provided and pctComplete is omitted, the server:
- Gets
totalLessonsfrom your course config - Adds up past and current
masteredUnits - Calculates:
round(total / totalLessons * 100), clamped 0–100 - Emits the result as
pctCompleteAppin theActivityCompletedEvent
If
pctComplete is provided alongside masteredUnits, the server uses pctComplete as-is and
does not run the auto-computation. The explicit value always wins.Configuration
Every Timeback course includestotalLessons in its metadata.metrics. The total number of lessons in the course. This is the denominator used for auto-computation.
timeback.config.json
Example walkthrough
Assume a course hastotalLessons: 10.
A student completes three activities over time:
| Submission | masteredUnits | Historical sum | Total mastered | pctCompleteApp |
|---|---|---|---|---|
| 1st | 3 | 0 | 3 | 30 |
| 2nd | 2 | 3 | 5 | 50 |
| 3rd | 2 | 5 | 7 | 70 |
Best practices
Send masteredUnits as an incremental count
Send masteredUnits as an incremental count
When a student masters one lesson, send
masteredUnits: 1. If they master two lessons in
the same activity session, send masteredUnits: 2. The value always represents how many
new units were mastered during this activity — never a running total.Attribute mastery for a lesson exactly once
Attribute mastery for a lesson exactly once
If a student replays a lesson they already mastered, do not send
masteredUnits again for
that lesson. Double-counting inflates the student’s progress percentage because the server
sums all historical values.Omit masteredUnits when no lessons were mastered
Omit masteredUnits when no lessons were mastered
If no lessons were mastered during the activity, omit
masteredUnits entirely (or send
0). The server only runs the auto-computation when masteredUnits is a number greater
than zero.Next steps
Custom Activities reference
Full API for
activity.end() and timeback.activity.record()Events
Caliper event schemas including
ActivityCompletedEventConfiguration
timeback.config.json reference including totalLessonsStateful activities
Multi-session activities where completion is recorded server-side