Skip to content

Fix division by zero error in ClinicActivityDataService-created-by-agentic #89

@asafchen-dig

Description

@asafchen-dig

An ArithmeticException is occurring in the ClinicActivityDataService.getActiveLogsRatio method due to a division by zero error when there are no logs for a given type.

Problem:
The method currently performs division without checking if the divisor (total number of logs) is zero, which causes an ArithmeticException.

Solution:
A fix has been implemented in PR #88 that:

  1. Adds input validation to check for zero divisor
  2. Returns 0 when no logs exist
  3. Adds debug logging to track values
  4. Converts the ratio to a percentage for better readability

Impact:
This error affects the clinic activity monitoring functionality and could cause service disruption when attempting to calculate ratios for activity types with no logs.

Testing:
The fix has been tested with:

  • Zero logs scenario
  • Normal operation scenario
  • Edge cases

Related PR: #88

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions