-
Notifications
You must be signed in to change notification settings - Fork 23
Add max length limitation to open questions and raise error for when travel fields are empty and travel is selected #4501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add max length limitation to open questions and raise error for when travel fields are empty and travel is selected #4501
Conversation
Add server-side validation to ensure that when `needs_funds_for_travel` is set to `True`, users must provide values for `departure_country`, `nationality`, and `departure_city`. This prevents incomplete or incorrect grant submissions by rejecting missing travel details with appropriate validation errors at the backend, mirroring the frontend requirement and ensuring consistency and data integrity.
Disable `debug_toolbar` from `INSTALLED_APPS` and its middleware in `test.py` settings to ensure tests pass locally regardless of developer setup.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4501 +/- ##
==========================================
- Coverage 94.53% 94.49% -0.04%
==========================================
Files 352 352
Lines 10131 10133 +2
Branches 733 734 +1
==========================================
- Hits 9577 9575 -2
- Misses 461 463 +2
- Partials 93 95 +2 🚀 New features to boost your workflow:
|
|
@claude do a code review |
|
Claude finished @marcoacierno's task —— View job Code ReviewI've completed a comprehensive review of PR #4501. Here's my detailed feedback: SummaryThis PR adds character limitations to grant application text fields and enforces that travel detail fields (departure country, city, nationality) are required when ✅ Strengths
🔍 Issues Found1. Missing maxLength enforcement on fullName and name fields (frontend/src/components/grant-form/index.tsx)Severity: Medium The backend enforces 300 character limits on
Recommendation: Add 2. Inconsistent required attribute on travel fields (frontend/src/components/grant-form/index.tsx)Severity: Low Lines 589-634: When Current code: <InputWrapper required={false}>
<Input {...text("departureCity")} required={true} ... />
</InputWrapper>Recommendation: Change 3. Test coverage gap (Codecov report)Severity: Low Codecov reports 4 lines missing coverage (75% patch coverage). While the existing tests are good, consider adding edge case tests:
💡 Additional ObservationsBackend (mutations.py)Lines 94-97: The conditional addition of required fields is clean and correct: if self.needs_funds_for_travel:
non_empty_fields.extend(
["departure_country", "departure_city", "nationality"]
)Lines 78-85: The max length validation loop is efficient. One minor suggestion - consider extracting the error message format to a constant for easier i18n in the future. Test file (test_send_grant.py)Lines 230-280: Lines 307-334: Good practice: The tests properly use the factory pattern and check both success and error scenarios. Settings (test.py)Lines 6-11: The django-debug-toolbar removal is correct and addresses the test failure mentioned in the PR description. The conditional removal prevents errors if it's already been removed. 📋 Summary of Recommendations
Final VerdictThe PR is in good shape and ready for merge after addressing the missing Great work on the implementation! The backend validation is robust and the test coverage demonstrates the functionality works as expected. |
…needed Fixes inconsistency in the grant form where `departureCountry` and `departureCity` fields were not enforced as required when the user selects that they need funds for travel (`needsFundsForTravel` is true). These fields are now mandatory in that scenario to ensure all necessary information is collected for travel grant applicants.
django-debug-toolbarfrom test config to fix local test failureWhat
ToDo