Skip to content

Fix division by zero in OwnerController.initUpdateOwnerForm-created-by-agentic#108

Closed
shaykeren wants to merge 1 commit intomainfrom
fix-division-by-zero-owner-controller-created-by-agentic
Closed

Fix division by zero in OwnerController.initUpdateOwnerForm-created-by-agentic#108
shaykeren wants to merge 1 commit intomainfrom
fix-division-by-zero-owner-controller-created-by-agentic

Conversation

@shaykeren
Copy link
Copy Markdown

This PR fixes a division by zero error in the OwnerController.initUpdateOwnerForm method that occurs when calculating average visits for owners with no pets.

Changes made:

  1. Fixed typo: averageCisits -> averageVisits
  2. Added null/zero check before division
  3. Cast to double for proper decimal division
  4. Added the average visits to the model with a proper attribute name
  5. Implemented safe handling for owners with no pets by returning 0.0

This fixes the issue where the owner edit functionality breaks for owners with no pets.

Related Issues: #105 (where the error was introduced)
Error ID: d60cbb62-3f3c-11f0-803c-42975a299f33

@doppleware doppleware closed this Jun 3, 2025
@doppleware doppleware deleted the fix-division-by-zero-owner-controller-created-by-agentic branch June 3, 2025 00: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.

2 participants