Skip to content

Sprint 7 M7: transfer ownership, overdue on project dashboard, D7 wee… - #68

Merged
SumitGauswami merged 1 commit into
mainfrom
sprint7/m7-transfer-overdue-d7
Nov 20, 2026
Merged

SumitGauswami merged 1 commit into
mainfrom
sprint7/m7-transfer-overdue-d7

Conversation

@harshgohil790

Copy link
Copy Markdown
Collaborator

What this PR does

Sprint 7 · M7: transfer ownership, overdue tasks on the project dashboard (FR-15), and D7 (real weekly goal on the Dashboard).

Changes

Transfer ownership

  • Team & roles: the Owner sees a crown button next to each other member → confirm → that member becomes Owner, the old Owner becomes Admin.
  • POST /api/projects/:id/transfer-ownership { userId, confirm: true }. One atomic MongoDB update swaps both roles and only matches while the caller is still Owner → always exactly one Owner; two simultaneous transfers: one wins, the other gets 409.
  • 403 for non-Owners, 400 without confirm / for yourself / bad IDs, 404 for a non-member.
  • After the transfer the former Owner can leave like any Admin (US-14). The "Transfer ownership first" dialog now explains how.
  • Logged as new activity type member.ownership_transferred; both people's open project pages get project:role-changed and switch role live.
  • The Owner role still can't be set through a role change or when adding a member (message now points to Transfer ownership).

Overdue on the project dashboard (FR-15)

  • Dashboard tab: new Overdue tile + list (open tasks past their due day, most overdue first, "N days overdue", assignee, milestone; click opens the task; first 50 + "+N more").
  • Uses project health's exact rule (overdueFilter / daysOverdue), so both views agree and nothing is both overdue and "due in the next 7 days". Visible to every member role.
  • GET /api/projects/:id/dashboard adds overdue: { total, limit, tasks }; an older server without it shows no overdue section.

D7: real weekly goal

  • Dashboard progress card: This week's goal: X of Y done = my assigned tasks due this week (Mon–Sun, UTC) and how many are Done, ring at the real %. Replaces the fixed "Weekly project goal · 4 of 5" (only the demo account keeps sample numbers).
  • GET /api/tasks/stats adds weekGoal: { from, to, total, done, percent }.

Shared files touched

routes/projects.js (new endpoint), lib/permissions.js, models/Activity.js (new type), TeamPanel.jsx, ProjectPage.jsx, DashboardPage.jsx, ProjectDashboard.jsx, api.js, roles.js, activityDisplay.js, styles.css, README (new Sprint 7 table with the M7 rows: if another Sprint 7 PR also adds the table, keep both sets of rows).
backend/test/myTasks.test.js updated: it compared /stats exactly and the answer now also has weekGoal.

How to test it

  1. As Owner, Team & roles → crown next to a member → Transfer ownership. Your badge becomes Admin, theirs Owner; Leave project now works. (Open the project as the other user in a second browser: their role switches live.)
  2. Create a task with a due date in the past → project Dashboard tab → it appears under Overdue with "N days overdue". Mark it Done → it disappears.
  3. Assign yourself a task due this week → main Dashboard → "0 of 1 done"; mark it Done → "1 of 1 done", ring 100%.

Checklist

  • Branched from the latest main (f719856, after feat(sprint7): M3 comments and replies on feed posts #67)
  • npm test passes in backend/ (1055/1055) and frontend/ (677/677)
  • npm run build passes in frontend/
  • npm run lint shows no errors
  • New behaviour has tests (backend transferOwnership, transferRules, projectDashboardOverdue, weeklyGoal; frontend TeamPanel.transfer, ProjectDashboard.overdue, weekGoal, new cases in DashboardPage.test)
  • README updated (Sprint 7 table)
  • No secrets, .env, node_modules or dist in the diff
  • Only my part of the sprint plan is in this PR
  • Commit is signed (Verified)

…kly goal

Owner can make another member the Owner and becomes Admin in one atomic update (exactly one Owner; concurrent transfers: one wins), after which leaving works; logged as member.ownership_transferred, live role update for both. Project dashboard lists overdue tasks (FR-15) with project health's rule, most overdue first. D7: Dashboard shows the real weekly goal (my tasks due Mon-Sun, done/total) instead of the fixed 4 of 5. Tests: backend 1055/1055, frontend 677/677.
@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devorbit Ready Ready Preview Nov 20, 2026 4:54pm UTC

@SumitGauswami SumitGauswami left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on Sprint 7 M7! The ownership transfer, overdue task tracking, and dynamic weekly goal features look well structured. Nice work on adding test coverage too!

@SumitGauswami
SumitGauswami merged commit cffc5c8 into main Nov 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants