Yu Yan taking over for Ujjwal - feat: added reasons array in infringements in user profile#1686
Yu Yan taking over for Ujjwal - feat: added reasons array in infringements in user profile#1686ujjwalbPipKcK wants to merge 1 commit intodevelopmentfrom
Conversation
|
This update thoughtfully introduces a reasons array for infringements in the user profile model, allowing for more robust and flexible categorization of issues such as "time not met," "missing summary," or "late reporting." The controller logic is clean and ensures reasons are consistently handled as a lowercased, deduplicated array with a safe default, which both improves data quality and simplifies future analytics or display logic. Testing and code review indicate the new functionality works as intended and is backward-compatible. Before merging, please resolve the outstanding branch conflicts, and consider adding a note to the docs if the reasons enum is expected to be updated regularly. |
Anusha-Gali
left a comment
There was a problem hiding this comment.
Hi Ujjwal,
I tried to review the PR which appears to be same as #1817 , i was not able to run the code and am getting the below error. This could be due too the conflicts or could be db changes for which i did copy paste the db.js of development branch though it didn't help.

- Add reasons field to infringement schema with enum validation - Supported values: 'time not met', 'missing summary', 'missed video call', 'late reporting', 'other' - Default value: ['other'] - Process reasons array in addInfringements controller: - Normalize to lowercase - Deduplicate values - Filter valid enum values only - Default to ['other'] if empty - Maintain backward compatibility with existing reason field - Resolves merge conflicts from PR #1686 and #1817
|
Redone with this PR: #2106 |



Description
Please include the exact bug/functionality description and a summary of the changes/ related issues. Please also include any other relevant motivation and context:

Fixes # (PRIORITY HIGH)
Related PRS (if any):
None
Main changes explained:
Added functionality to easily parse reasons for Blue Squares using a reasons array. Added the reasons a
How to test:
npm run buildandnpm startto run this PR locallyapi/userProfile/:userId/addInfringementto add an infringementScreenshots or videos of changes:
2025-08-29.18-57-46.mp4