Skip to content

Conversation

@gfortaine
Copy link
Collaborator

Fixes

Fixes #[issue number] by @[issue author]

Description

Technical details

Tests

Guillaume FORTAINE added 2 commits December 22, 2025 20:47
- Calculate expected patient count based on percentage and parent cohort size
- Show error message when percentage would result in 0 patients
- Disable create button until a valid percentage is entered

Ref gestion-de-projet#3117
- Test error message when percentage results in 0 patients
- Test create button is disabled for invalid samples
- Test valid percentage allows sample creation

Ref gestion-de-projet#3117
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issue #3117 by adding validation to prevent creating sample cohorts that would result in zero patients. When a user selects a percentage that would yield zero patients after rounding down (e.g., 1% of 3 patients = 0.03 → 0), the form now displays an error message and disables the create button.

Key changes:

  • Added zero patient validation logic using Math.floor to calculate expected patient count
  • Updated UI to show contextual error messages when percentage would result in zero patients
  • Added comprehensive test coverage for the new validation feature

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/components/Researches/Modals/CreateSample.tsx Implements zero patient validation by calculating expected patient count and adding error state that blocks sample creation when the result would be zero patients
src/components/Researches/Modals/tests/CreateSample.test.tsx Adds comprehensive test suite covering various scenarios: error cases with small cohorts/percentages, success cases with valid combinations, and edge cases at boundaries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gfortaine gfortaine changed the title Fix/3117 block zero patient samples fix(samples): block zero patient samples - Ref gestion-de-projet#3117 Dec 26, 2025
@gfortaine gfortaine force-pushed the fix/3117-block-zero-patient-samples branch from d05f550 to cf3a4f3 Compare December 26, 2025 15:15
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.

2 participants