What is wrong with my date query?
Hi, i have the problem that i cannot delete my records that are older than (e.g.,) 20 days.
my second dimension has dates in this format:
2025-11-16 14:10:22
My deletion automation looks something like this:
Datum
less than
%last 20 days% (Y-m-d H:i:s)
simulation:
{"count":534}
Expected: Deletion of all entries older than 20 days.. but the selected records are the records from today...
if i change is to
greater than, then i get the same result
{"count":534}
My 22000 records from 3 month ago are still there :D
EDIT: After I enabled the DB query log (mariadb). I figured out, that both simulations (with less than and greater than) execute this sql command:
SELECT COUNT(*) AS `count` FROM `oc_analytics_facts` WHERE (`dataset` = '3') AND (`dimension2` > '2025-11-16 00:11:00'
The `less than`` query is translated in some place to the wrong sql symbol...
So I think there is something wrong with the sql query builder?
--> I think the error is here:
https://github.com/Rello/analytics/blob/59d205948cc6ff41cb199625a1148cb5663fc194/lib/Service/VariableService.php#L148
GT is always returned from the function and overides e.g., "LT"