Skip to content

#13550 - Fixed error message when entering age in person form#13561

Merged
KarnaiahPesula merged 1 commit intodevelopmentfrom
bugfix-13550-error_msg_when_entering_age
Aug 13, 2025
Merged

#13550 - Fixed error message when entering age in person form#13561
KarnaiahPesula merged 1 commit intodevelopmentfrom
bugfix-13550-error_msg_when_entering_age

Conversation

@raulbob
Copy link
Copy Markdown
Contributor

@raulbob raulbob commented Aug 4, 2025

  • Added logic to handle age input correctly

Summary by CodeRabbit

  • Refactor

    • Improved handling of approximate age input for safer data entry.
    • Enhanced code readability and consistency throughout the person editing form.
    • Minor logic improvements for determining emancipation eligibility.
  • Style

    • Standardized formatting and spacing in the person editing form interface.

- Added logic to handle age input correctly
@raulbob raulbob linked an issue Aug 4, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 4, 2025

Walkthrough

This change refactors the PersonEditForm class with code cleanup, formatting improvements, and safer parsing for approximate age input. It removes unused imports, standardizes spacing, and introduces a new helper method to safely parse age strings, replacing direct parsing. No core functionality or business logic is altered.

Changes

Cohort / File(s) Change Summary
PersonEditForm Refactor
sormas-ui/src/main/java/de/symeda/sormas/ui/person/PersonEditForm.java
Removed unused imports, improved formatting, standardized spacing, refactored age parsing logic, added parseApproximateAge helper method, and removed redundant null check.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

In fields of code where rabbits leap,
A tidy patch, a promise to keep.
Imports trimmed and logic neat,
Age parsed safely—what a treat!
With whitespace even and bugs at bay,
This bunny cheers: "Hip-hip-hooray!" 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acfe63d and dd3e496.

📒 Files selected for processing (1)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/person/PersonEditForm.java (10 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: SORMAS CI
🔇 Additional comments (7)
sormas-ui/src/main/java/de/symeda/sormas/ui/person/PersonEditForm.java (7)

51-51: LGTM - Import organization improvements.

The import statement formatting changes improve code organization without affecting functionality.

Also applies to: 97-97


408-420: LGTM - Formatting improvements enhance readability.

The multiline formatting for the boolean initialization and stream processing makes the code more readable while preserving the original logic.


705-705: LGTM - Indentation fix.

The indentation correction improves code consistency.


716-716: LGTM - Spacing standardization.

The spacing adjustments improve code consistency and formatting.

Also applies to: 729-729


738-753: LGTM - Improved age parsing logic addresses the PR objective.

The replacement of direct Integer.parseInt() with the new parseApproximateAge() method significantly improves error handling when parsing age strings. This change directly addresses the PR objective of fixing error messages when entering age in the person form by safely handling formatted input (with commas, spaces, etc.).


755-766: Excellent implementation of the age parsing helper method.

The parseApproximateAge() method is well-designed and addresses the core issue:

  • Handles null/empty input gracefully
  • Removes formatting characters (commas, spaces, etc.) using regex
  • Prevents parsing empty strings after cleaning
  • Returns null on parsing failures instead of throwing exceptions
  • Improves user experience by accepting various age input formats

This implementation directly fixes the error message issue mentioned in the PR objective.


779-779: LGTM - Final spacing adjustments.

The remaining spacing adjustments in updateHasGuardianCheckBox() complete the formatting standardization throughout the file.

Also applies to: 784-784, 797-797

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix-13550-error_msg_when_entering_age

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sormas-vitagroup
Copy link
Copy Markdown
Contributor

@KarnaiahPesula KarnaiahPesula merged commit b0f80ee into development Aug 13, 2025
8 of 10 checks passed
@KarnaiahPesula KarnaiahPesula deleted the bugfix-13550-error_msg_when_entering_age branch August 13, 2025 08:50
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.

error msg when entering age

3 participants