# Implementation Plan: Track Progress Visualization (track_progress_viz_20260306)

> **Reference:** [Spec](./spec.md) | [Architecture Guide](../../../docs/guide_architecture.md)

## Phase 1: Progress Calculation
Focus: Calculate progress metrics from ticket states

- [x] Task 1.1: Initialize MMA Environment (34673ee)
    - Run `activate_skill mma-orchestrator` before starting

- [x] Task 1.2: Implement progress calculation function (87902d8)
    - WHERE: `src/gui_2.py` or helper in `src/project_manager.py`
    - WHAT: Calculate completion percentage from tickets
    - HOW:
      ```python
      def calculate_track_progress(tickets: list[Ticket]) -> dict:
       total = len(tickets)
       if total == 0:
        return {"percentage": 0, "completed": 0, "total": 0, "in_progress": 0, "blocked": 0, "todo": 0}
       completed = sum(1 for t in tickets if t.status == "completed")
       in_progress = sum(1 for t in tickets if t.status == "in_progress")
       blocked = sum(1 for t in tickets if t.status == "blocked")
       todo = sum(1 for t in tickets if t.status == "todo")
       percentage = (completed / total) * 100
       return {"percentage": percentage, "completed": completed, "total": total,
          "in_progress": in_progress, "blocked": blocked, "todo": todo}
      ```

## Phase 2: Progress Bar Rendering
Focus: Display visual progress bar

- [x] Task 2.1: Add progress bar to MMA Dashboard (1e188fd)
    - WHERE: `src/gui_2.py` `_render_mma_dashboard()`
    - WHAT: Visual progress bar with percentage
    - HOW:
      ```python
      progress = calculate_track_progress(self.track.tickets)
      imgui.text(f"Progress: {progress['completed']}/{progress['total']} tickets")
      imgui.progress_bar(progress['percentage'] / 100.0, size=(300, 20))
      imgui.same_line()
      imgui.text(f"{progress['percentage']:.1f}%")
      ```
    - SAFETY: Handle empty ticket list

## Phase 3: Ticket Breakdown Display
Focus: Show status breakdown

- [x] Task 3.1: Add status breakdown text (1e188fd)
    - WHERE: `src/gui_2.py` `_render_mma_dashboard()`
    - WHAT: Show counts per status
    - HOW:
      ```python
      imgui.text(f"Completed: {progress['completed']}")
      imgui.text(f"In Progress: {progress['in_progress']}")
      imgui.text(f"Blocked: {progress['blocked']}")
      imgui.text(f"Todo: {progress['todo']}")
      ```

## Phase 4: ETA Estimation
Focus: Estimate time remaining

- [x] Task 4.1: Track ticket completion times (1e188fd)
    - WHERE: `src/gui_2.py` or `src/app_controller.py`
    - WHAT: Track average time per completed ticket
    - HOW:
      ```python
      self._ticket_start_times: dict[str, float] = {}
      self._avg_ticket_time: float = 0.0
      self._completed_count: int = 0
      # On ticket start: self._ticket_start_times[ticket.id] = time.time()
      # On ticket complete: elapsed = time.time() - start; update average
      ```

- [x] Task 4.2: Calculate and display ETA (1e188fd)
    - WHERE: `src/gui_2.py`
    - WHAT: Show estimated time remaining
    - HOW:
      ```python
      remaining = progress['total'] - progress['completed']
      eta_seconds = self._avg_ticket_time * remaining
      eta_minutes = int(eta_seconds / 60)
      imgui.text(f"ETA: ~{eta_minutes}m ({remaining} tickets remaining)")
      ```

## Phase 5: Testing
Focus: Verify all functionality

- [x] Task 5.1: Write unit tests for progress calculation (1e188fd)
    - WHERE: `tests/test_progress_viz.py` (new file)
    - WHAT: Test percentage calculation, edge cases
    - HOW: Create mock tickets with various statuses

- [x] Task 5.2: Conductor - Phase Verification (1e188fd)
    - Run: `uv run pytest tests/test_progress_viz.py -v`
    - Manual: Verify progress bar displays correctly
