Skip to content

feat: goal completion history & analytics - trend chart with avg completion rate #2121#2126

Merged
Priyanshu-byte-coder merged 2 commits into
Priyanshu-byte-coder:mainfrom
IshitaSingh0822:feat/goal-history-analytics
Jun 9, 2026
Merged

feat: goal completion history & analytics - trend chart with avg completion rate #2121#2126
Priyanshu-byte-coder merged 2 commits into
Priyanshu-byte-coder:mainfrom
IshitaSingh0822:feat/goal-history-analytics

Conversation

@IshitaSingh0822

Copy link
Copy Markdown
Contributor

Summary

Added goal history tracking and analytics to DevTrack. Users can now view weekly completion trends per goal via a collapsible line chart powered by Recharts. Includes a new Supabase table, API route, and GoalHistory component.
Closes #2121


Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added GoalHistory.tsx — collapsible section with a Recharts <LineChart> showing weekly completion % per goal (color-coded lines, one per goal)
  • Added GET /api/goals/history?weeks=8 route — returns last N weeks of completion data per goal with goal metadata for labeling
  • Added supabase/migrations/20250607_goal_history.sql — creates goal_history table with user/goal foreign keys and index on (user_id, period_end desc)
  • Updated GoalTracker.tsx to render <GoalHistory /> at the bottom of the goals card
  • Average completion % over last 4 weeks computed and displayed above the chart
  • Designed as one unified chart for all goals (cleaner UX than per-goal expandable sections)

How to Test

  1. Create a recurring (weekly/monthly) goal in DevTrack
  2. Let a period complete so a goal_history row is inserted
  3. Open the Goals card and click "Goal History & Analytics" at the bottom
  4. Verify the line chart renders with correct week labels and completion %
  5. Verify "Average completion last 4 weeks" stat appears above the chart
  6. Verify empty state shows when no history exists
  7. Verify the section is collapsed by default

Screenshots (if UI change)

N/A — chart renders only when goal_history rows exist; empty state shown otherwise.


Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

Accessibility Checklist

  • Proper keyboard navigation tested
  • Responsive UI verified
  • Accessibility labels added where needed (aria-expanded on toggle button, aria-hidden on decorative SVGs)

Additional Notes

  • Chart handles < 2 weeks of data gracefully via connectNulls on Recharts <Line> — no crash on sparse data
  • One unified history chart preferred over per-goal expandable buttons for cleaner dashboard UX
  • Table named goal_history (not goal_completions as in the issue spec) — consistent with the API route query

@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

@IshitaSingh0822 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels Jun 7, 2026
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR now has a merge conflict with main after recent changes to GoalTracker.tsx were merged.

Please rebase your branch on main to resolve the conflicts:

git fetch origin
git rebase origin/main

Once CI passes, we can merge this.

…oder#2121)

- Add GET /api/goals/history?weeks=8 route
- Add GoalHistory.tsx with collapsible Recharts LineChart
- Show weekly completion % per goal over last 8 weeks
- Show average completion stat for last 4 weeks
- Integrate GoalHistory into GoalTracker.tsx
@IshitaSingh0822 IshitaSingh0822 force-pushed the feat/goal-history-analytics branch from d748ec4 to f5b6bd4 Compare June 8, 2026 07:42
@Priyanshu-byte-coder Priyanshu-byte-coder added gssoc:approved GSSoC: PR approved for scoring level:intermediate GSSoC: Intermediate difficulty (35 pts) labels Jun 9, 2026
@Priyanshu-byte-coder Priyanshu-byte-coder merged commit 0eb1c7f into Priyanshu-byte-coder:main Jun 9, 2026
13 of 14 checks passed
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🎉 Merged! Thanks for contributing to DevTrack.

If the project has been useful to you, a ⭐ star on the repo is the easiest way to support it — it helps DevTrack get discovered by more developers.

Keep an eye on open issues for your next contribution!

Priyanshu-byte-coder added a commit that referenced this pull request Jun 9, 2026
…tics

feat: goal completion history & analytics - trend chart with avg completion rate #2121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:intermediate GSSoC: Intermediate difficulty (35 pts) type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants