Skip to content

Add min/max validation constraint to LetterSoundAssessmentEvent #2198

@jo-elimu

Description

@jo-elimu
          _🛠️ Refactor suggestion_

Add validation constraint for mastery score range.

The JavaDoc specifies a range [0.0, 1.0] but there's no validation to enforce this constraint.

+import jakarta.validation.constraints.DecimalMax;
+import jakarta.validation.constraints.DecimalMin;

 /**
  * A value in the range [0.0, 1.0].
  */
+@DecimalMin(value = "0.0", message = "Mastery score must be between 0.0 and 1.0")
+@DecimalMax(value = "1.0", message = "Mastery score must be between 0.0 and 1.0")
 private Float masteryScore;
🤖 Prompt for AI Agents
In src/main/java/ai/elimu/entity/analytics/LetterSoundAssessmentEvent.java
around lines 29 to 32, the masteryScore field has a JavaDoc specifying it should
be in the range [0.0, 1.0], but no validation enforces this. Add a validation
annotation such as @DecimalMin("0.0") and @DecimalMax("1.0") to the masteryScore
field to ensure the value stays within the specified range.

Originally posted by @coderabbitai[bot] in #2195 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions