From d8887eaf5bb1544999c098d5776b1d8ae289d4f8 Mon Sep 17 00:00:00 2001 From: Ching Date: Sun, 9 Feb 2025 18:14:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(models):=20=E4=BC=98=E5=8C=96ScanLog?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 简化ScanLog模型中查询今天日志的方法,使用更简洁的ORM查询方式。 --- models.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/models.py b/models.py index 8d9c978..618a7af 100644 --- a/models.py +++ b/models.py @@ -31,10 +31,7 @@ class ScanLog(BaseModel): today_end = datetime.combine(today, time.max) # End of day (23:59:59.999999) # Query logs for today - return cls.objects.filter( - scan_at__gte=today_start, - scan_at__lte=today_end - ).order_by('-scan_at') + return cls.select().where(cls.scan_at.between(today_start, today_end)) def serialize(self): # Try to get product info from BarcodeDB