In Participant View replay timelines, task ordering can become incorrect when a participant navigates backward using the previous button.
The startTime / endTime values can affect the replay timeline ordering and make tasks appear out of sequence. They should always show up in the their sequence order
Specification
Added after specification review.
Summary
Participant View replay timelines should render tasks in study sequence order even when a participant used Previous and the saved startTime / endTime values are no longer monotonic. This should be a replay rendering fix, not a stored-data migration.
Decisions
- Sort replay task entries by parsed
trialOrder, using sequence step first, dynamic funcIndex second, and task identifier as a stable tie-breaker.
- Keep
startTime / endTime as the source for timeline scale, task bar position, bar width, duration, and browsed-away overlays.
- Include incomplete answers with
startTime === 0 in the same sequence-order sort rather than appending them after completed tasks.
- Sort dynamic block trials such as
3_0, 3_1, and 3_2 by parent step and then funcIndex; if both a non-dynamic 3 and dynamic children exist, the non-dynamic step sorts before its dynamic children.
- Do not modify saved participant answer data.
- Do not change analytics summaries or exported data ordering unless they share the same visible Participant View replay timeline bug.
Acceptance Criteria
Out of Scope
- Rewriting participant answer persistence.
- Changing how
startTime / endTime are collected.
- Changing exported analytics semantics.
- Adding new libraries.
Implementation Notes
- The likely control point is
src/analysis/individualStudy/replay/AllTasksTimeline.tsx, which currently sorts completed tasks by startTime while incomplete tasks use trialOrder.
- Prefer reusing the existing
parseTrialOrder utility instead of adding ad-hoc parsing logic.
- Existing think-aloud replay code already orders answers by parsed
trialOrder with an identifier tie-breaker; use that as the behavioral reference.
Testing Notes
- Add a focused Vitest test for out-of-order timestamps where
trialOrder is still ordered, including at least one dynamic trialOrder case.
- Confirm timestamp-driven visual metrics still use
startTime / endTime after the ordering change.
In Participant View replay timelines, task ordering can become incorrect when a participant navigates backward using the previous button.
The
startTime/endTimevalues can affect the replay timeline ordering and make tasks appear out of sequence. They should always show up in the their sequence orderSpecification
Added after specification review.
Summary
Participant View replay timelines should render tasks in study sequence order even when a participant used Previous and the saved
startTime/endTimevalues are no longer monotonic. This should be a replay rendering fix, not a stored-data migration.Decisions
trialOrder, using sequence step first, dynamicfuncIndexsecond, and task identifier as a stable tie-breaker.startTime/endTimeas the source for timeline scale, task bar position, bar width, duration, and browsed-away overlays.startTime === 0in the same sequence-order sort rather than appending them after completed tasks.3_0,3_1, and3_2by parent step and thenfuncIndex; if both a non-dynamic3and dynamic children exist, the non-dynamic step sorts before its dynamic children.Acceptance Criteria
startTimevalues caused by Previous navigation.trialOrderstep andfuncIndex.startTime === 0.startTime/endTime.trialOrder.AllTasksTimelinebehavior using out-of-order timestamps.Out of Scope
startTime/endTimeare collected.Implementation Notes
src/analysis/individualStudy/replay/AllTasksTimeline.tsx, which currently sorts completed tasks bystartTimewhile incomplete tasks usetrialOrder.parseTrialOrderutility instead of adding ad-hoc parsing logic.trialOrderwith an identifier tie-breaker; use that as the behavioral reference.Testing Notes
trialOrderis still ordered, including at least one dynamictrialOrdercase.startTime/endTimeafter the ordering change.