Implement AttendanceNewPage — attendance-taking form
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Implement AttendanceNewPage — the attendance-taking form coaches use to record a new session. The page presents a searchable, paginated list of class learners, each with a toggle to mark them present or absent. Coaches submit the session to save it to the database. Builds on the stub added in #14236.
Complexity: Medium Target branch: release-v0.19.x
Context
AttendanceNewPage is the core coach action in the attendance feature — coaches arrive here from the "Mark attendance" button in AttendanceBlock. The session timestamp is captured when the route is entered, so the date/time in the header accurately reflects when the session started.
The Change
AttendanceNewPage (kolibri/plugins/coach/frontend/views/attendance/AttendanceNewPage.vue):
CoachImmersivePagewith an H1 showing the session date/time (captured on route enter, formatted viaformatAttendanceDateTime)- Learner table (
CoreTable) with two visibility-hidden headers — learner name and status:- Learners sorted alphabetically, paginated at 50 per page
- Searchable via
KTextbox— filters by learner name - Per-learner
KSwitch(defaultfalse); whentrue, row shows "Present" label and$themePalette.blue.v_100background - "Mark all learners present"
KSwitchat the top of the table — triggers aKModalconfirmation when marking all present
BottomAppBar— live present/absent count, Cancel and Submit buttons- Submit — calls
createSession, redirects toATTENDANCE_HISTORYwith a success snackbar; shows error snackbar on failure - Unsaved changes guard —
beforeRouteLeaveprompts with aKModalif the coach navigates away with unsaved changes
Design Spec
| Description | Screen |
|---|---|
| Attendance taking form | |
| Present state — row highlight and bottom bar | |
| Mark all present confirmation modal |
Out of Scope
- Editing an existing session (separate issue —
AttendanceEditPage) - Attendance history list (separate issue —
AttendanceHistoryPage)
Acceptance Criteria
General
- [ ] Session timestamp is captured when the route is entered and displayed in the page H1
- [ ] Learners are sorted alphabetically and paginated at 50 per page
- [ ] Learner list is filterable by name via a search box
- [ ] Each learner row has a
KSwitchdefaulting tofalse; whentrue, the row shows a "Present" label and a$themePalette.blue.v_100background - [ ] A "Mark all learners present"
KSwitchat the top of the table triggers aKModalconfirmation before applying - [ ]
BottomAppBardisplays live present and absent counts - [ ] Submitting calls
createSessionand redirects toATTENDANCE_HISTORYwith a success snackbar - [ ] On error, the user remains on the page and an error snackbar is shown
- [ ] Navigating away with unsaved changes prompts a
KModalconfirmation
Styling
- [ ] Present row background uses
$themePalette.blue.v_100, not a hardcoded colour
Accessibility and i18n
- [ ] Table headers are present in the DOM but visually hidden
- [ ] Each
KSwitchhas anaria-labelledbyreferencing a visually hidden label - [ ] All user-visible strings are internationalised
- [ ] Page is keyboard navigable
Testing
- [ ] Learner list renders sorted and paginated correctly
- [ ] Search filtering works correctly
- [ ]
KSwitchtoggle updates present/absent counts in the bottom bar - [ ] Mark all present confirmation modal appears before applying
- [ ] Successful submit redirects to history with snackbar
- [ ] Failed submit shows error snackbar and stays on page
- [ ] Unsaved changes guard fires on navigation away
References
- Issue #14236 — stub page being fleshed out
- Issue #14022 — original feature spec with design references
GroupMembersPage— example of an interactive learner table in the coach plugin
🤖 This issue was written with AI assistance, under supervision, review and final edits by [@akolson] 🤖
Implementation Plan: AttendanceNewPage
Branch: issue-14242-a8a461 (target: release-v0.19.x)
Architecture
Replace the AttendanceNewPage stub with a full attendance-taking form using CoachImmersivePage, CoreTable, PaginatedListContainer, KSwitch, KModal, and BottomAppBar. Learner data comes from the existing classSummary Vuex store. Submission uses useAttendance composable's createSession. All strings use createTranslator.
Files Modified
| File | Change |
|---|---|
kolibri/plugins/coach/frontend/views/attendance/AttendanceNewPage.vue |
Full page implementation |
kolibri/plugins/coach/frontend/views/attendance/__tests__/AttendancePages.spec.js |
Expanded tests |
Phases
Phase 1: Core component structure & learner table
- CoachImmersivePage shell with session timestamp in H1 (captured on route enter)
- Searchable, paginated learner table (PaginatedListContainer + CoreTable, 50/page, sorted alphabetically)
- Visually hidden table headers for accessibility
Phase 2: Toggle, mark-all, and bottom bar
- Per-learner KSwitch (default false) with present-row highlighting (
$themePalette.blue.v_100) - "Mark all learners present" KSwitch with KModal confirmation
- BottomAppBar with live present/absent counts, Cancel and Save buttons
Phase 3: Submit, error handling, unsaved-changes guard
- Submit calls
createSession, redirects to ATTENDANCE_HISTORY with success snackbar - Error handling: stays on page with error snackbar
beforeRouteLeaveguard with KModal whenisDirtyis true
Phase 4: Tests (9 tasks)
- Sorted rendering, search filtering, toggle counts, mark-all modal, submit success/failure, unsaved-changes guard (full flow including modal confirm/cancel)
Key Decisions
isDirtyflag for unsaved-changes detection (set on first toggle, never unset except on submit/confirm-leave) — more robust than checking attendanceMap values- Reuses existing
attendanceStringsfor present/absent counts fromkolibri-common @vue/test-utilsfor complex tests — follows the pattern fromAttendanceBlock.spec.js; simpler stub tests keep Vue Testing Library
Implementation Complete: AttendanceNewPage
All 4 phases implemented and verified:
What was built
- CoachImmersivePage wrapper with session timestamp captured on mount
- Searchable, paginated learner table (50/page, alphabetically sorted) using
PaginatedListContainer+CoreTable - Per-learner KSwitch toggles with present-row highlighting via
$themePalette.blue.v_100 - Mark-all-present switch with
KModalconfirmation before applying - BottomAppBar with live present/absent counts (reusing
attendanceStrings) - Submit flow: calls
createSession, redirects to history with success snackbar; error snackbar on failure - Unsaved-changes guard:
beforeRouteLeavewithKModalconfirmation when dirty - Shared strings: Cancel/Confirm/Save use
coreString()fromcommonCoreStrings
Test evidence
Test Suites: 3 passed, 3 total
Tests: 35 passed, 35 total (14 new for AttendanceNewPage)
Code quality
- Ran /simplify review: removed redundant
.visuallyhiddenCSS (global exists), replaced duplicate Cancel/Confirm/Save strings withcoreString(), extracted$store/$routerfrom proxy, moved$themePaletteto template - Lint: all hooks pass
- Follows established patterns from
AttendanceBlock.spec.jsfor test infrastructure
Files changed
kolibri/plugins/coach/frontend/views/attendance/AttendanceNewPage.vue— full implementationkolibri/plugins/coach/frontend/views/attendance/__tests__/AttendancePages.spec.js— 14 tests
Self-Review Summary
Reviewed git diff release-v0.19.x...HEAD (2 files, 703 lines added).
Acceptance Criteria
All 20 acceptance criteria verified as met (general, styling, a11y/i18n, testing). All 14 tests pass.
Findings & Fixes
Fixed (suggestion):
- Removed unused
visuallyhiddenspan withstatus-label-*id that was never referenced by anyaria-*attribute - Removed
present-labelCSS class usage with no corresponding style rules - Consolidated into a single conditional
<span>— committed in981f18d
Noted (nitpick, no action):
- Test file uses
@vue/test-utils— follows existing coach plugin pattern (10+ existing spec files use it)
Praised:
- Thorough unsaved-changes guard logic with correct
isDirty/submittinginteraction - Clean composable mock patterns following established
__mocks__/conventions
Mostly fixed in #14364 - will need some follow up for full product conformance.