fix: Fix timestamp filtering inconsistency

Corrects the timestamp comparison in the status filtering logic
by using the adjusted datetime object for accurate filtering,
ensuring list results reflect intended timestamp boundaries.
This commit is contained in:
Kumi 2024-11-28 18:35:45 +01:00
parent a377722339
commit d98aa34e14
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -56,7 +56,7 @@ class StatusListView(LoginRequiredMixin, ListView):
if "to" in self.request.GET: if "to" in self.request.GET:
to_timestamp = datetime.strptime(self.request.GET["to"], "%Y-%m-%d") to_timestamp = datetime.strptime(self.request.GET["to"], "%Y-%m-%d")
to_timestamp = to_timestamp.replace(hour=23, minute=59, second=59) to_timestamp = to_timestamp.replace(hour=23, minute=59, second=59)
status_list = status_list.filter(timestamp__lte=self.request.GET["to"]) status_list = status_list.filter(timestamp__lte=to_timestamp)
return status_list return status_list