Aayush create line chart showing total injuries over time backend#1687
Aayush create line chart showing total injuries over time backend#1687aayushshetty12 wants to merge 5 commits intodevelopmentfrom
Conversation
|
Tested functionality- commented in the corresponding #3995 chain. |
|
Tested the related frontend PR - 3995. The PR changes work as expected. |
|
Tested alongside Frontend PR 3995 |
|
Hey Aayush, |
|
Hi Aayush, |
Anusha-Gali
left a comment
There was a problem hiding this comment.
Hi Aayush,
I have reviewed this PR locally, similar to other i too am not able to see any projects and the screen says "No Data Available" as mentioned in my frontend.
bhanuanishakkineni
left a comment
There was a problem hiding this comment.
Hello Aayush,
I have tried testing your PR. While I tried to start the server, it's unable to connect to database because of incorrect uri. Please update the uri in db.js as per new connection. Or use the uri from development branch.

I have updated this locally to test the PR and its working.
I have also commented on frontend PR #3995. Please check it out.
|
Hi Aayush, Tried to review your PR. Similar to others I am also not able to see any projects and the page says "No Data Available". |
|
Hi Ayush , I have tested this PR and have given my comment here OneCommunityGlobal/HighestGoodNetworkApp#3995 (comment) |
|
hi ayush , i have tested this PR and this is my comment |
There was a problem hiding this comment.
hi ayush , i have tested this PR and this is my comment
link:OneCommunityGlobal/HighestGoodNetworkApp#3995 (review)
Ganesh112001
left a comment
There was a problem hiding this comment.
Tested functionality- commented in the corresponding #3995 front end PR
|
Hi @aayushshetty12 , left my comments here |
|
Hello Ayush, |
| const query = {}; | ||
|
|
||
| if (projectIds) { | ||
| const projectIdArray = projectIds.split(',').map((id) => mongoose.Types.ObjectId(id)); |
There was a problem hiding this comment.
If any of the projectIds values are not valid ObjectIds, the new mongoose.Types.ObjectId(id) call will throw an uncaught error.
| const injuries = await InjuryOverTime.aggregate([ | ||
| { $match: query }, | ||
| { | ||
| $group: { |
There was a problem hiding this comment.
The $group stage groups by projectId, severity, injuryType, and department but not by date/month. Since the frontend charts injuries over time by month, this means the aggregation is collapsing all time periods into a single row per combination, which seems like it would break the chart entirely.
|
I have tested and reviewed this PR locally, also posted comments and screenshots on the frontend for PR #3995 |
|






Description
Related PRS (if any):
To test this backend PR you need to checkout the #3995 frontend PR.
…
Main changes explained:
…
How to test:
npm installandnpm run startto run this PR locallyScreenshots or videos of changes:
demo.mp4