Skip to content

Shreya P taking over for Abhiram Bylahalli Jagadish – Display List of Finished Tasks Reported by Students#1799

Open
abhirambj wants to merge 11 commits intodevelopmentfrom
feature/abhiram-educator-task-submissions
Open

Shreya P taking over for Abhiram Bylahalli Jagadish – Display List of Finished Tasks Reported by Students#1799
abhirambj wants to merge 11 commits intodevelopmentfrom
feature/abhiram-educator-task-submissions

Conversation

@abhirambj
Copy link
Copy Markdown

@abhirambj abhirambj commented Oct 11, 2025

Description

This PR implements the backend endpoint for educator task submissions as required for the "Display List of Finished Tasks Reported by Students" feature. Educators can view student task completions and uploads in a dynamic task list, supporting filtering by status, student, and course. The response includes student name, task name, submission link, status badge/tag, and submitted date. All controller and model logic is updated for proper data population, filter handling, and code quality compliance.
Screenshot 2025-10-10 at 7 09 32 PM

Related PR:

Frontend: OneCommunityGlobal/HighestGoodNetworkApp#4207


Implements:

  • GET endpoint /api/educationportal/educator/task-submissions
  • Supports query parameters: status, studentId, courseId for filtering
  • Return fields: studentName, task, submissionLink, status, submittedAt
  • Status tags (Submitted / Pending Review / Graded) and review page link included in response
  • Controller and models use correct references and population for student and lesson plan

Main changes explained

  1. Backend Endpoint
    • GET /api/educationportal/educator/task-submissions fetches completed and graded student submissions
    • Filters: status, student ID, course ID via query params
    • Returns: student name, task name, submission link(s), status badge, submission date
  2. Population and Formatting
    • Populates student and lesson plan details for each response record
    • Adds badge/tag for status, review page link for easy educator review
  3. Coding Standards
    • All controller/model logic is ESLint compliant
    • Code refactored for clarity and future frontend integration

How to test

Prerequisites:

  • Check out the feature branch: git checkout feature/abhiram-educator-task-submissions
  • (Optional) Clean install: rm -rf node_modules package-lock.json && npm cache clean --force && npm install
  • Start the backend server: npm run dev

API Testing Steps:
Note: All requests must use the full path /api/educationportal/educator/task-submissions.

  1. Obtain a valid JWT token for an educator account.
  2. Use Postman, curl, or any API client to send a GET request to:
    http://localhost:4500/api/educationportal/educator/task-submissions
    With query params as needed:
  • status
  • studentId
  • courseId

Expected:

  1. An unfiltered array of finished student tasks for educators, formatted with all required fields. Requests without or with invalid JWT should be rejected.
    Backend API Request
  2. A filtered request showing Pending review for status=completed as per the requirement.
    Backend API with Filtering
    Note: Screenshots above show visual examples. Sample JSON outputs below use generic placeholder data and do not reflect real user information.

Test Cases for Educator Task Submissions API

Prerequisites

  • Local server running on port 4500
  • Valid educator authentication token
  • API testing tool (Postman, curl, etc.)
  • Confirm /api/educationportal/educator/task-submissions endpoint is accessible

Test 1: Basic Request (No Filters)

Request:

  • Method: GET
  • URL: http://localhost:4500/api/educationportal/educator/task-submissions
  • Headers:
    • Authorization: Bearer
    • Content-Type: application/json
      Verify:
  • Response is an array of submission objects
  • Each object contains:
    • studentName, studentEmail, taskName, taskType, submissionLinks, status, submittedAt, assignedAt, dueAt, grade, feedback, lessonPlanId
  • Badges/tags for status (Pending Review, Graded, etc.) are present
  • No filters applied, all completed/graded tasks for all students/courses shown
    Sample Output:
[
  {
    "studentName": "<student-name>",
    "studentEmail": "<student-email>",
    "taskName": "<task-name>",
    "taskType": "<task-type>",
    "submissionLinks": ["<submission-url>"],
    "status": "<status>",
    "submittedAt": "<timestamp>",
    "assignedAt": "<timestamp>",
    "dueAt": "<timestamp>",
    "grade": "<grade-or-null>",
    "feedback": "<feedback-or-null>",
    "lessonPlanId": "<lesson-plan-id>"
  }
]

Test 2: Filter by Status Only

Request:

[
  {
    "studentName": "<student-name>",
    "studentEmail": "<student-email>",
    "taskName": "<task-name>",
    "taskType": "<task-type>",
    "submissionLinks": ["<submission-url>"],
    "status": "Pending Review",
    "submittedAt": "<timestamp>",
    "assignedAt": "<timestamp>",
    "dueAt": "<timestamp>",
    "grade": null,
    "feedback": null,
    "lessonPlanId": "<lesson-plan-id>"
  }
]

Test 3: Filter by Student

Request:


Test 4: Missing/Invalid Auth Token

Request:

  • Omit or use invalid token in header
    Verify:
  • Status: 401 Unauthorized or appropriate error
  • No data leaked

This implementation completes all listed backend requirements for the educator dashboard task list feature.

@Anusha-Gali
Copy link
Copy Markdown

Anusha-Gali commented Nov 7, 2025

Hi Abhiram,

I have tested this PR locally, the frontend works as required but in the backend - i was able to identify few issues.

  1. The Test 3 : http://localhost:4500/api/educationportal/educator/task-submissions?studentId=
Screenshot 2025-11-07 at 3 48 15 PM
  • this does give me an array containing all student details but when i give a studentId (example taken as highlighted in above picture) it returns an empty array as shown below:
Screenshot 2025-11-07 at 3 49 58 PM Screenshot 2025-11-07 at 3 55 09 PM
  1. In the same Test 3 - there is a mention of "Combination with status filter: ?status=graded&studentId=" . I have tested this too and found issues.
Screenshot 2025-11-07 at 4 00 43 PM

a) when i give status as graded and a student id it shows empty string
Screenshot 2025-11-07 at 3 51 46 PM

b) when i give status as pending/graded i get data which is both graded and pending
Screenshot 2025-12-24 at 5 32 44 PM
Screenshot 2025-12-24 at 5 33 21 PM

Note: Have updated my comment on Dec 24th and the issues still persist

Copy link
Copy Markdown
Contributor

@sayali-2308 sayali-2308 left a comment

Choose a reason for hiding this comment

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

Image Image Image Image

Backend running on: http://localhost:4500
Branch: feature/abhiram-educator-task-submissions
Testing tool: Postman
Database: MongoDB with education portal test data
Date: February 3, 2026

Summary:
Educator Task Submissions API endpoint fully functional and tested. GET /api/educationportal/educator/task-submissions successfully retrieves student task submissions with all required fields (studentName, studentEmail, taskName, taskType, submissionLinks, status, submittedAt, assignedAt, dueAt, grade, lessonPlanId, lessonPlanTitle). All query parameter filters working correctly (status: completed/graded, studentId). Status badges properly mapped (completed → Pending Review, graded → Graded). Multiple submission links supported. Population logic working for student and lesson plan details. Response structure clean and matches API requirements. Ready for frontend integration.
Overall: All requirements met, filters working as expected, proper data population and formatting. Ready to merge.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@one-community one-community changed the title Abhiram Bylahalli Jagadish – Display List of Finished Tasks Reported by Students Shreya P taking over for Abhiram Bylahalli Jagadish – Display List of Finished Tasks Reported by Students Mar 17, 2026
Copy link
Copy Markdown

@ShreyaMP1999 ShreyaMP1999 left a comment

Choose a reason for hiding this comment

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

https://www.dropbox.com/scl/fo/3uqzokj7v8mtktqb7i79i/AAb9tkmADXGhsreZjMQShL8?rlkey=e5vpdhilt1jso0ak9fhyd4ol8&st=qfxmrbce&dl=0

I reviewed the existing implementation for the Educator Task Submissions feature and made a few necessary improvements to both the frontend and backend to ensure stability and consistency. On the frontend, I fixed duplicate rendering issues, ensured stable React keys for submission cards, normalized status handling to align with backend responses, and added safer date handling to avoid invalid comparisons. I also improved edge-case handling for student name initials and ensured better resilience in UI rendering. On the backend, I verified the response structure and filtering logic to confirm it aligns correctly with the frontend requirements.

I tested the complete flow end-to-end, including API validation in Postman, UI behavior in the browser, and responsiveness using Safari mobile simulator. All core functionalities such as filtering, grouping, status display, and late submission detection are working as expected. Screenshots and testing evidence have been uploaded to the Dropbox link for reference.

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 Shreya,

I have reviewed the PR in postman and the API responses are as per requirement.

Image Image Image Image Image

@SharadhaKasiviswanathan
Copy link
Copy Markdown

I have tested and reviewed this PR locally, also posted comments and screenshots on the frontend for PR #4207
OneCommunityGlobal/HighestGoodNetworkApp#4207 (comment)
OneCommunityGlobal/HighestGoodNetworkApp#4207 (comment)

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

6 participants