Skip to content

Sphurthy taking over for Taariq: Add Lesson Plan Builder UI and update routes#2098

Closed
TaariqMansurie wants to merge 18 commits intodevelopmentfrom
taariq-feature-lesson-plan-builder-backend
Closed

Sphurthy taking over for Taariq: Add Lesson Plan Builder UI and update routes#2098
TaariqMansurie wants to merge 18 commits intodevelopmentfrom
taariq-feature-lesson-plan-builder-backend

Conversation

@TaariqMansurie
Copy link
Copy Markdown
Contributor

@TaariqMansurie TaariqMansurie commented Mar 11, 2026

Description

This PR implements the backend API and database schemas for the "Assign Lesson Plan" feature. It introduces the endpoints required to assign lesson plan tasks to eligible students and logs the assignment history.
Implements # (PRIORITY HIGH) Phase 4 - Assign Lesson Plan - Backend API (WIP Taariq)

Related PRS (if any):

This backend PR is related to the frontend PR for the UI integration.
To test this backend PR, you need to checkout the corresponding frontend PR.

Main changes explained:

  • Create models/educationTask.js for the schema defining assigned student tasks.
  • Create models/lessonPlanLog.js for the schema tracking assignment and edit history.
  • Create routes/educatorRouter.js for the /api/educator/assign-tasks endpoint (handles student eligibility and bulk task creation) and the /logs/:lessonPlanId endpoint.
  • Update routes.js to register the new /api/educator routes.

How to test:

  1. check into current branch
  2. do yarn install or npm install and start the local server
  3. log in as an admin or educator user on the frontend (using the related frontend branch)
  4. go to the Lesson Plan Builder page and trigger an assignment (manual or auto)
  5. verify the API returns a 200 success response with the correct assigned/skipped counts
  6. verify in the database (MongoDB) that new documents are created in the educationtasks and lessonplanlogs collections.

Screenshots or videos of changes:

Note:

CLOSED: Update PR: #2145

@sonarqubecloud
Copy link
Copy Markdown

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Mar 17, 2026
Copy link
Copy Markdown
Contributor

@ManojPuttaswamy ManojPuttaswamy left a comment

Choose a reason for hiding this comment

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

Both route handlers contain significant business logic directly in the router file — DB queries, task creation, logging, eligibility checks. This should be moved to educatorController

let skippedCount = 0;
const tasksToCreate = [];

const assignerId = req.body.requestor.requestorId;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If requestor is missing from the request body, this will throw a TypeError that falls through to the catch block and returns a 500 instead of a proper 400 validation error.

Copy link
Copy Markdown

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

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

Hi Taariq,

I have reviewed the mongoDB and the latest i can find in education tasks is dated for March 19 when today is March 18. Also upon refresh the subtask created by me does not appear again.

Image Image Image Image

@one-community one-community changed the title Taariq: Add Lesson Plan Builder UI and update routes Sphurthy taking over for Taariq: Add Lesson Plan Builder UI and update routes Mar 22, 2026
@sphurthy
Copy link
Copy Markdown

sphurthy commented Apr 3, 2026

This PR has been redone in PR: #2145

@sphurthy sphurthy closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants