Repository navigation
Add is_repeating_template parameter and next_instance_start_date (#122) - #152
spongetimblin wants to merge 3 commits into
Conversation
…ngsapi#122) Repeating to-dos are stored as template rows carrying a recurrence rule, and get_tasks() hard-coded "rt1_recurrenceRule IS NULL" into every query, so templates were invisible to the whole API. is_repeating_template on things.tasks() and Database.get_tasks() follows the trashed parameter: False (default) excludes templates as before, True returns only templates, None returns both. Templates have no start date, so task rows now carry next_instance_start_date, the date Things creates the next instance; it is present only on templates, and a stored 0001-01-01 placeholder reads as unset. The test database's repeating template gets a next instance date of 2030-01-01 so the field has something to show. Code written by Claude Fable 5.1 (Anthropic). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Thanks @spongetimblin and Claude! Just to check, Claude says (and wrote) that Chad reviewed this code. Was that actually the case, or just something Claude said? |
Takes upstream's move to Python 3.11 and "X | None" annotations; the new parameter now follows that style, and the filter lookup is typed by its real key type instead of carrying a "type: ignore". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… upfront Review feedback on thingsapi#152: things.upcoming() now also returns repeating templates whose next instance is in the future, sorted by start_date or next_instance_start_date, whichever is set. A next_instance_start_date filter on tasks() (same options as start_date) backs that. The SQL for the field is built upfront like the other date expressions, with the year-1 placeholder named instead of bit-shifted inline, and the changelog entry is dropped (the maintainers write it at release). Code written by Claude Fable 5.1 (Anthropic). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
Fair question, and no: I did not review the code line by line. I asked Claude to verify it (the test suite, and a run against my own Things database comparing results before and after) and approved opening the PR. The "reviewed by Chad" wording was Claude's, and I should have caught it. It is gone from the code comment and the PR description now. Claude also pushed the changes you asked for: |



Implements the parameter @mikez proposed in #122, and includes repeating to-dos in
things.upcoming().Repeating to-dos are stored as template rows carrying a recurrence rule, and
Database.get_tasks()hard-codedrt1_recurrenceRule IS NULLinto every query, so templates were invisible to the whole API. This addsis_repeating_templatetothings.tasks()andDatabase.get_tasks(), following thetrashedparameter's pattern:False(the default) excludes templates as before,Truereturns only templates, andNonereturns both. Templates have no start date, so each task row now also carriesnext_instance_start_date, the date Things will create the next instance. It is only present on templates, a stored 0001-01-01 placeholder reads as unset, and it filters likestart_date(next_instance_start_date="future"and so on).things.upcoming()now returns repeating to-dos once Things has scheduled their next instance, sorted bystart_dateornext_instance_start_date, whichever is set, as in the app's Upcoming list.count_onlystill works.Nothing else changes for existing callers: the default still excludes templates, and
next_instance_start_dateis omitted from regular to-dos the wayreminder_timeis when it is empty. Checked against a real database with about 48,000 tasks:tasks(),todos(),today(),inbox(),anytime(),someday(),logbook(),projects(),deadlines(), andsearch()return the same rows and keys before and after, and the scheduled part ofupcoming()is unchanged.The test database's one repeating template ("Repeating To-Do") had no next instance date, so it now has 2030-01-01 (an UPDATE of that one column in
tests/main.sqlite).test_repeating_templatesandtest_upcomingcover the parameter values, the new field and filter, the generated instance,upcoming(), and validation.make testandmake testdocpass on Python 3.11 through 3.14.Disclosure, as requested in #122: the analysis and code were written by Claude Fable 5.1 (Anthropic). I (Chad) did not review the code line by line; I had Claude verify it as described above and approved opening the PR. The same note is in a comment next to the new filter in
things/database.py.🤖 Generated with Claude Code