Peewee range queries omit accepted events longer than 24 hours

Open
#194 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 10 days

@TimeToBuildBob is already working on this.

Since Oct 28, 2026.

  • #197 by @TimeToBuildBob — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
flask, python
Domain
backend, database

Research direction

Start by reading _where_range and the PeeweeStorage range query, then inspect the regression tests for bounded reads and counts. Reproduce the supplied 48-hour event case with the Flask test client and a disposable database. Done means overlapping events remain included with the stated inclusive boundaries and UTC normalization, with regression coverage and the ordinary-query performance trade-off measured.

Written by the indexing model from the issue text.

Description

PeeweeStorage accepts a 48-hour event but omits it from reads and counts inside its second day. Reproduced on master c7821899ab38c1a39c87d7bf011c22a78de9b205 with a disposable database through aw-server's Flask test client: insert 2026-10-01T00:00:00Z, duration 172800; unbounded GET returns the event, while start=2026-10-02T12:00:00Z and end=2026-10-02T13:00:00Z returns [] and count 0. The timestamp >= start - 24h prefilter in _where_range drops the row before the true overlap predicate. This also affects bounded CSV/AQL consumers. Expected: accepted events whose end is >= start and timestamp <= end remain included, preserving existing inclusive boundaries and UTC normalization. Scope: regression tests and correct inclusion without new duration limits, schema migration or stored-history changes; measure the ordinary-query performance trade-off.

Dominant language
Python
Stars
65
Forks
74
Avg merge
7d 7h
Merged PRs (30d)
11

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ActivityWatch/aw-core

All issues in ActivityWatch/aw-core

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.