Juhitha taking over for Saicharan - Project status summary API for donut chart (backend)#1709
Juhitha taking over for Saicharan - Project status summary API for donut chart (backend)#1709Saicharan1505 wants to merge 16 commits intodevelopmentfrom
Conversation
aditya2512
left a comment
There was a problem hiding this comment.
The aggregation pipeline in projectStatus.service.js is well-designed efficiently grouping by project status and date range. The use of dayjs for robust date parsing and validation of both startDate and endDate parameters prevents edge case API misuse. Schema indexes on the project status fields are good for scale, especially with time windowed queries.
Error handling is granular, with informative responses for 400 (bad request) and 500 (internal error). Returning both count and percentage in the response is ideal for frontend integration, especially for chart generation (like a donut chart). Integration of the new route into the central router is clear and non-intrusive.
As a possible enhancement, adding API documentation (Swagger/OpenAPI or README) will further help frontend devs consume this endpoint. Recommend expanding test coverage with unit and integration tests for both controller and service logic to future proof any status logic changes.
Aswin20010
left a comment
There was a problem hiding this comment.
Reviewed PR #4040+1709 (Project Status Donut Chart Visualization). Verified proper integration with backend and correct rendering of the donut chart with Active, Completed, and Delayed project segments. Confirmed hover tooltips display accurate counts and percentages, and total project count appears at the chart center. Tested From/To date filters for functional accuracy and verified numeric data alignment in the right-side panel. Checked CSS module styling consistency and responsiveness. No functional or UI regressions found — approved the PR.
|
Hi @vamsidharpanithi |
Screen.Recording.2026-03-02.at.10.32.27.PM.movResolved merge conflicts and tested locally. Please verify |
|
| // Utility to compute percentages safely | ||
| const calcPct = (count, total) => (total ? Number(((count / total) * 100).toFixed(1)) : 0.0); | ||
|
|
||
| async function getProjectStatusSummary({ startDate, endDate }) { |
There was a problem hiding this comment.
The function has no try/catch. If the aggregation fails, the error will propagate unhandled to the caller.
|
I have tested and reviewed this PR locally, also posted comments and screenshots on the frontend for PR #4040 |
|


















Description
Implements Phase 2 Summary Dashboard: Project Status Donut Chart (Backend).
This feature provides an API endpoint
/api/project-status/summarythat aggregates Active, Completed, and Delayed projects, supporting date filters.Implements # (Phase 2 Action Item)
Related PRS (if any):
This backend PR is related to the #4040 frontend PR.
Main changes explained:
projectStatusmodel for storing project status data.projectStatusService.jsto aggregate counts and percentages.projectStatusController.jsto handle requests with optional date filters.projectStatusRouter.jsand registered it inroutes.js.How to test:
Check into this branch:
git fetch origin feature/project-status-donut-backendgit checkout feature/project-status-donut-backendnpm installandnpm run dev.GET http://localhost:4500/api/project-status/summary?startDate=YYYY-MM-DD&endDate=YYYY-MM-DDfilters.totalProjectsactiveProjects,completedProjects,delayedProjectspercentagesfor each categorywindowwith startDate and endDate.Screenshots or videos of changes:
Note:
projectStatusService.js.