Skip to content

[FEATURE] Goal completion history & analytics — track goal trends over time with a completion rate chart #2121

@IshitaSingh0822

Description

@IshitaSingh0822

Summary

The current GoalTracker only shows current week goals with no history.
Users can't see if they've been improving, slipping, or consistent over time.
Add a goal history log and a completion rate trend chart.

Why

Without history, goals feel disposable. Tracking completion rates over weeks
creates accountability and shows progress — the core value proposition of DevTrack.

Proposed Solution

DB changes

  • New table: goal_completions(id, user_id, goal_id, week_start DATE, completed_at, target, actual)
  • On goal reset each week (from issue [FEAT] Recurring goals — auto-reset weekly/monthly goals on schedule #86 recurring goals), snapshot previous week's state into goal_completions
  • Add GET /api/goals/history?weeks=8 route — returns last N weeks of completion data per goal

New component: GoalHistory.tsx

  • Line chart (Recharts <LineChart>) showing weekly completion % over last 8 weeks
  • One line per active goal (color-coded)
  • X-axis: week labels (e.g. "May 12", "May 19")
  • Y-axis: 0–100%
  • Summary row: "Average completion last 4 weeks: 72%"
  • Expandable/collapsible — collapsed by default in dashboard

GoalTracker.tsx update

  • Add a "History" button next to each goal that expands GoalHistory.tsx inline

Acceptance Criteria

  • goal_completions table added via migration
  • GET /api/goals/history returns per-goal weekly data
  • GoalHistory.tsx renders line chart with Recharts
  • History section collapsible in dashboard
  • Average completion stat computed and shown
  • Passes lint and type-check
  • Works gracefully with < 2 weeks of data (no chart crash)

I would like to work on this under GSSoC
/assign

Metadata

Metadata

Labels

enhancementNew feature or requestgssoc:assignedGSSoC: Issue assigned to a contributor

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions