From 972e4be811ff9c136a77b2eb326f4206ef8b92da Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Tue, 10 May 2016 20:13:10 -0700 Subject: [PATCH] log: cutoff at the max id past the cutoff_date Previously we were using the min, which is always going to be equivalant to the min id in the table. --- data/model/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/model/log.py b/data/model/log.py index 0dbf53b87..13c21429d 100644 --- a/data/model/log.py +++ b/data/model/log.py @@ -162,7 +162,7 @@ def get_stale_logs_cutoff_id(cutoff_date): """ Gets the most recent ID created before the cutoff_date. """ try: return (LogEntry - .select(fn.Min(LogEntry.id)) + .select(fn.Max(LogEntry.id)) .where(LogEntry.datetime <= cutoff_date) .tuples())[0][0] except IndexError: