Bug #3033
Fix Session History Advanced Filters
0%
Description
The advanced filters in the Session History API/UI are not filtering session data correctly.
Currently, selecting conditions such as "Equal to", "Less than", "Greater than", "Between", etc. can result in incorrect records being returned. For example, when Duration is set to "Equal to 20", sessions with durations such as 5 minutes, 9 minutes, and other values can also be returned.
- Required Fix
Correct the advanced filtering flow across the frontend, controller, and repository.
- Duration Filter
Support the following operators correctly:
- Equal to → `eq`
- Less than → `lt`
- Less than or equal to → `lte`
- Greater than → `gt`
- Greater than or equal to → `gte`
- Between → `between`
Example:
`durationOp=eq&maxDurationMinutes=20`
must return only sessions where duration is exactly 20 minutes.
- Energy Filter
Support:
- Equal to
- Less than
- Less than or equal to
- Greater than
- Greater than or equal to
- Between
using:
`energyOp`, `minEnergyKwh`, and `maxEnergyKwh`.
- Average Power Filter
Support:
- Equal to
- Less than
- Less than or equal to
- Greater than
- Greater than or equal to
- Between
using:
`powerOp`, `minPowerKw`, and `maxPowerKw`.
Average Power equality should use consistent decimal precision and must not incorrectly match nearby values.
- Validation
The API should reject invalid filter combinations with HTTP 400.
Examples:
- Filter value supplied without an operator
- Invalid operator
- `eq` with both minimum and maximum values
- `between` without both minimum and maximum values
- Minimum value greater than maximum value
- Negative numeric filter values
- Other Filters
Verify that the following filters continue to work correctly together with the advanced numeric filters:
- Machine
- Station
- Location
- Connector ID
- Connector Number
- Date range
- Status
- Search
- Vendor
- Show All
- Pagination
Ensure the filtered record count and paginated data use the same filter conditions.
- Acceptance Criteria
1. Duration = 20 returns only sessions with duration exactly equal to 20.
2. `<`, `<=`, `>`, `>=`, and `Between` return only records satisfying the selected condition.
3. Energy and Average Power filters behave the same way.
4. Invalid filter combinations return HTTP 400.
5. Multiple filters are combined correctly using AND logic.
6. Pagination totals reflect the filtered dataset.
7. Existing Machine, Station, Location, Connector, Date, Status, Search, Vendor, and Show All filters continue to work.
8. The API request contains the correct operator parameter for the selected UI condition.
9. No session outside the selected numeric filter condition is returned.
10. All advanced-filter combinations are tested in Swagger and the Session Management UI.
No data to display