Team Accomplishments
How to read this doc
Start with Context for the problem, then jump to Page design for the concrete UI spec. The Merged work-time algorithm section covers the overlap-dedup logic. Implementation phases has the build sequence. Markdown source: docs/devtasks/team-accomplishments.md.
Contents
1. Context
Sponic tracks work across several disconnected surfaces: Tasks (completion notes, activity log), DevControl Sessions (Claude session telemetry), and WorkLogs (associate time entries). When a manager asks “what did Sonia do today?” or “what did the team ship this week?”, the answer requires cross-referencing three different pages and mentally stitching the timeline together.
The task_session_links table already connects tasks to sessions, and the completion modal captures a summary note and linked sessions at done-time. The missing piece is a read-only dashboard that assembles this data into a per-person accomplishment feed.
Goal
A single page where you can see, for any team member in any time range:
- Total merged work time — wall-clock, overlap-deduplicated across all sessions.
- Logged hours from WorkLogs (for associates who clock in/out), shown alongside session time for comparison.
- Every completed task with: completion note, linked sessions (with individual durations), result URL, and link to the task itself.
2. Data model changes
2.1 New field: result_url on tasks
Add a nullable result_url TEXT column to public.tasks. Holds a link to the deliverable — a deployed page, a PR, a doc, a design file. Set at completion time or edited later.
ALTER TABLE public.tasks ADD COLUMN result_url TEXT;
2.2 No new tables
Everything else already exists:
| Table | What it provides |
|---|---|
tasks |
completed_at, completed_by, title, status, result_url |
task_activity |
action=‘completed’ entries with the completion note in comment |
task_session_links |
task_id + session_id + linked_at |
time_entries |
associate_id, clock_in, clock_out, duration_minutes |
associate_profiles |
app_user_id, hourly_rate |
| Sessions API | /sessions/:id → started_at, duration_mins, title, summary |
3. Merged work-time algorithm
Session time for a person must not double-count overlapping sessions. The algorithm:
- Gather all sessions linked to any completed task for a person in the selected time range.
- Convert each session to an interval:
[started_at, started_at + duration_mins]. - Sort intervals by start time.
- Merge overlapping/adjacent intervals: walk the sorted list, extend the current interval if the next one overlaps, otherwise close it and start a new one.
- Sum the durations of all merged intervals.
This runs at render time in the browser. No stored aggregation.
Cross-task overlap rule
If two sessions overlap but are linked to different tasks, the overlapping time is counted once in the person’s total. Individual session durations displayed per-task remain their raw values (factual telemetry), but the person-level total is always the merged wall-clock span.
4. Page design
4.1 Location
New page at /en/accomplishments (top-level nav item between “Work Summaries” and “DevControl”). Alternatively, a new tab under Tasks called “Accomplishments” — decision at build time based on nav density.
4.2 Filters
- Person: dropdown of all
app_userswho have completed tasks. Default: all. - Date range: from/to date pickers. Presets: Today, Last 7 days, Last 30 days.
4.3 Layout
Each person gets a card showing their merged session time, optional logged hours, and a list of completed tasks:
For associates with WorkLogs entries (e.g. Mariia), the card also shows logged hours alongside session time, enabling comparison.
4.4 Task row details
Each completed task row shows:
- Task number + title (links to task drawer)
- Completed-at timestamp
- Completion note (from
task_activitywhere action=‘completed’) - Result URL (clickable link, or “—” if not set)
- Linked sessions with their individual raw durations
- Session title or summary as a tooltip/subtitle
5. Completion modal enhancement
The completion modal (shown when marking a task “done”) already collects a note and session links. Add a result_url input field:
- Text input with placeholder “Link to result (PR, page, doc)...”
- Positioned between the textarea and the session picker
- Saved to
tasks.result_urlon submit - Optional — the task can be completed without it
6. Implementation phases
Phase 1 — Schema + result_url field
- Migration: add
result_urlcolumn totasks - Update
Tasktype inlib/tasks.ts - Add
result_urlinput to the completion modal - Add
result_urldisplay + edit to the task detail drawer
Phase 2 — Accomplishments data layer
- New
lib/accomplishments.tswith query helpers:getCompletedTasksByPerson(dateFrom, dateTo)— tasks where status=‘done’, grouped by completed_bymergeSessionIntervals(sessions[])— the overlap-dedup algorithmgetLoggedHoursForUser(userId, dateFrom, dateTo)— query time_entries via associate_profiles
Phase 3 — Accomplishments page (read-only)
- New route:
/[lang]/(intranet)/accomplishments/page.tsx - Add nav link
- Person cards with merged time, task list, session links
- Date range + person filters
Phase 4 — WorkLogs comparison
- Show logged hours alongside session time for associates
- Match time_entries to the same date range
- Visual indicator when logged hours significantly differ from session time
Phase 5 — Polish + linking
- Link tasks from WorkLogs entries (optional
task_idontime_entries) - “Add result link” inline action for tasks missing one
- Export/share accomplishments for a person + date range
Build journal
No entries yet — appended by /feature, /journal, and /wrap.