- Removed duplicated and unnecessary date filtering logic in the SQL query
- Simplified the query structure by eliminating repetitive time range checks
- Ensured that the remaining date filtering is handled properly through parameter validation
- Improved code readability and maintainability by reducing complexity in the WHERE clause