Skip to content

Validation to not allow have patient with different user #278

Merged
edimossilva merged 8 commits intoespoo-dev:mainfrom
lucasleandro1:fix-validation-eventprocedure-unique-user
Apr 28, 2025
Merged

Validation to not allow have patient with different user #278
edimossilva merged 8 commits intoespoo-dev:mainfrom
lucasleandro1:fix-validation-eventprocedure-unique-user

Conversation

@lucasleandro1
Copy link
Contributor

@lucasleandro1 lucasleandro1 commented Apr 15, 2025

Validation of the EventProcedure model to ensure that there is no patient with different user

fix #96

@lucasleandro1 lucasleandro1 force-pushed the fix-validation-eventprocedure-unique-user branch from 2e45275 to f67423e Compare April 17, 2025 17:03
def match_user_with_patient_user
return if patient.nil? || user.nil?

return unless patient.user_id != user_id
Copy link
Member

Choose a reason for hiding this comment

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

Avoid using unless together with negation

Suggested change
return unless patient.user_id != user_id
return if patient.user_id == user_id

@edimossilva edimossilva merged commit ec0c235 into espoo-dev:main Apr 28, 2025
3 checks passed
@lucasleandro1 lucasleandro1 changed the title fixes validation to not allow have patient with different user Validation to not allow have patient with different user May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add validation to not allow event_procedure to have patient with different user

2 participants