Skip to content

[FOSSOVERFLOW-25]feat: Implement Hierarchical Task Assignment & Progress Tracking System #236

@harshitap1305

Description

@harshitap1305

Description

This feature introduces a structured Project Management layer to the application. It allows organizational leaders to delegate tasks, set deadlines, and monitor progress. The system is designed to mirror the actual hierarchy of the institute, ensuring that assignments follow a strict chain of command.


1. The Hierarchy Rules (Assignee Scoping)

The "Assign To" dropdown in the frontend must be dynamically filtered based on the logged-in user's role to prevent unauthorized assignments:

  • PRESIDENT: Can assign tasks to any user with a role of GENSEC_*, CLUB_COORDINATOR, or any PositionHolder.
  • GENSEC (e.g., SciTech): Can only assign tasks to Coordinators or Position Holders whose organizational unit belongs to the 'scitech' category.
  • CLUB COORDINATOR: Can only assign tasks to Position Holders belonging specifically to their own unit_id.

2. Task Schema

A new Task collection is required. It includes fields for submission links and a verification loop.

const taskSchema = new mongoose.Schema({
  title: { type: String, required: true },
  description: { type: String, required: true },
  assigned_by: { 
    type: mongoose.Schema.Types.ObjectId, 
    ref: 'User', 
    required: true 
  },
  assignees: [{ 
    type: mongoose.Schema.Types.ObjectId, 
    ref: 'User', 
    required: true 
  }],
  unit_id: { 
    type: mongoose.Schema.Types.ObjectId, 
    ref: 'Organizational_Unit' 
  },
  deadline: { type: Date, required: true },
  priority: { 
    type: String, 
    enum: ['low', 'medium', 'high'], 
    default: 'medium' 
  },
  status: { 
    type: String, 
    enum: ['pending', 'in-progress', 'under-review', 'completed'], 
    default: 'pending' 
  },
  submission_note: { type: String, default: "" }, // Link to work (Drive/Doc) or description
  admin_notes: { type: String, default: "" }, // Feedback from the assigner
  created_at: { type: Date, default: Date.now },
  updated_at: { type: Date, default: Date.now }
});

3. The "Two-Step" Verification Workflow

To ensure quality control, the status updates are split between the Assignee and the Assigner:

  1. Student/ (Assignee) Permissions:

    • Can move task from pendingin-progress.
    • Can move task from in-progressunder-review (Must provide a submission_link).
    • Cannot mark a task as completed.
  2. Head (Assigner) Permissions:

    • Reviews tasks in the under-review state.
    • Can move task to completed (closes the task).
    • Can move task back to in-progress if the work is unsatisfactory (with admin_notes).

4. Technical Requirements

  • MVC Pattern: All logic must be placed in controllers/taskController.js. Route files should only handle the endpoint definition and middleware.
  • Backend Validation: The POST /api/tasks endpoint must verify that the assigned_by user has the authority to assign to the chosen assignees based on the hierarchy rules.
  • Frontend UI:
    • Heads: Need a "Task Creator" modal and a "Progress Monitor" dashboard to see the status of all tasks they've assigned.
    • Students/All role expect President Need a "My Tasks" card on their dashboard to update their progress and submit work.

Acceptance Criteria (Task Checklist)

  • Task Schema implemented in the backend.
  • Controller logic created for createTask, updateTaskStatus, and getTaskStats.
  • Hierarchical filtering implemented: Assigner only sees valid assignees in the dropdown.
  • Verification logic: Only the assigner can move a task to completed.
  • Frontend "Task Tracker" UI added to the Student Profile.
  • Frontend "Delegated Tasks" UI added to the Admin Profile/Dashboard.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions