Skip to content

Yu Yan taking over for Ujjwal - feat: added reasons array in infringements in user profile#1686

Closed
ujjwalbPipKcK wants to merge 1 commit intodevelopmentfrom
ujjwal_upd_infg_array_reasons
Closed

Yu Yan taking over for Ujjwal - feat: added reasons array in infringements in user profile#1686
ujjwalbPipKcK wants to merge 1 commit intodevelopmentfrom
ujjwal_upd_infg_array_reasons

Conversation

@ujjwalbPipKcK
Copy link
Copy Markdown

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)
image

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

  • Added reasons field under infringements in userProfile with predefined options (which can be modified as required)

How to test:

  1. check into current branch
  2. do npm run build and npm start to run this PR locally
  3. send a POST request to api/userProfile/:userId/addInfringement to add an infringement
  4. reasons = ['time not met', 'missing summary', 'missed video call', 'late reporting', 'other']

Screenshots or videos of changes:

2025-08-29.18-57-46.mp4

@ujjwalbPipKcK ujjwalbPipKcK added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Aug 30, 2025
Copy link
Copy Markdown
Contributor

@akshith312 akshith312 left a comment

Choose a reason for hiding this comment

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

Checked into local branch and tested with the POST Request:
image

Successfully being written to DB.
image

@ujjwalbPipKcK ujjwalbPipKcK changed the title feat: added reasons array in infringements in user profile Ujjwal - feat: added reasons array in infringements in user profile Sep 12, 2025
@aditya2512
Copy link
Copy Markdown

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.

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 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.
Screenshot 2025-12-16 at 8 22 57 PM

@VijayAnirudh
Copy link
Copy Markdown

This seems to be same as PR1817. However, I got erros while running backend. Please check the image:
image

@one-community one-community changed the title Ujjwal - feat: added reasons array in infringements in user profile Yu Yan taking over for Ujjwal - feat: added reasons array in infringements in user profile Feb 27, 2026
yany960 pushed a commit that referenced this pull request Mar 16, 2026
- 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
@one-community
Copy link
Copy Markdown
Member

Redone with this PR: #2106

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