change consumption date type & handle fuel anomaly detection
Improve the fuel consumption anomaly detection logic to make it more accurate, consistent, and aligned with real operational rules.
1. Cleanup of ConsumptionUtils
Removed unnecessary or unused helper methods.
Kept only the business-critical logic for consumption comparison.
Simplified the codebase and improved maintainability.
2. Anomaly detection now uses only normal recent consumptions
Previously, all previous anomalies were excluded from history.
Now, we exclude only anomalies of the same type as the one being checked. → More precise detection and fewer false positives.
3. New rule: Fuel type anomaly based on the vehicle’s official fuel type
Instead of comparing with past consumptions, the system now checks against the vehicle’s declared fuel type (vehicle.fuelType.name).
The vehicle is retrieved using the registration number.
If the consumed product does not match the vehicle’s fuel type → anomaly detected.
4. Updated detectDifferentProducts logic
Does not rely on previous consumptions anymore.
Uses the vehicle’s expected fuel type for validation.
More reliable, since vehicles do not change fuel type.
5. Added anomalyTypeToIgnore parameter
Allows excluding only related anomalies when retrieving recent consumptions.
Optional for detection functions that do not need this constraint
Closes VSN-1983