Skip to content

feat: Study cohorts — group enrollment with shared progress & leaderboard #1027

Description

@Anuoluwapo25

Summary

Build study cohorts (squads) from scratch: small groups of learners enrolled in the same track who share a group progress view, a private discussion thread, and a group leaderboard. New feature — no cohort logic exists today.

Background

Learning is more sticky when social. The platform has individual enrollment and a public forum, but nothing that groups learners into accountable units working the same track together.

What to build

1. Database migration

CREATE TABLE IF NOT EXISTS cohorts (
  id            SERIAL PRIMARY KEY,
  name          TEXT NOT NULL,
  course_slug   TEXT NOT NULL,
  start_date    DATE NOT NULL,
  max_members   INTEGER NOT NULL DEFAULT 8,
  created_by    TEXT NOT NULL,
  created_at    TIMESTAMPTZ DEFAULT NOW()
);

CREATE TABLE IF NOT EXISTS cohort_members (
  cohort_id     INTEGER NOT NULL REFERENCES cohorts(id) ON DELETE CASCADE,
  learner_addr  TEXT NOT NULL,
  joined_at     TIMESTAMPTZ DEFAULT NOW(),
  PRIMARY KEY (cohort_id, learner_addr)
);

2. Backend

  • POST /api/cohorts create (name, course, start date, size).
  • GET /api/cohorts?course= list joinable cohorts.
  • POST /api/cohorts/:id/join / POST /api/cohorts/:id/leave (auth, capacity-checked).
  • GET /api/cohorts/:id → members with per-member milestone progress (join against existing milestone_reports) and a group completion %.

3. Frontend

  • "Squads" tab on the course page: browse/join cohorts or create one.
  • Cohort detail: member roster with progress bars, group completion ring, and an embedded discussion thread (reuse the existing CommentSection).
  • Group leaderboard sorted by milestones completed.

4. Tests

  • Capacity enforcement, join/leave idempotency, group progress aggregation.

Acceptance criteria

  • A learner can create and join a cohort for a course
  • Cohort detail shows real per-member progress
  • Capacity is enforced; can't join a full cohort
  • Discussion thread scoped to the cohort works

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26backendAPI/database/infrastructureenhancementNew feature or requestfeatureNew feature implementationfrontendReact/TypeScript UI work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions