Skip to content

feat: select --priority - #90

Open
tobixen wants to merge 3 commits into
masterfrom
select-priority
Open

tobixen wants to merge 3 commits into
masterfrom
select-priority

Conversation

@tobixen

@tobixen tobixen commented Nov 13, 2026

Copy link
Copy Markdown
Member

Depends on PyCalendar/icalendar-searcher#27 - merge after icalendar-searcher 1.4.0 is released.

Commit message:

select had no way to filter on priority. --priority takes a number,
a range or a list (5, 1-3, 1,5-9), sidestepping the question of
whether "max" means highest number or highest importance. 0 also
matches a missing PRIORITY. The filtering is client-side, through
the new "in" operator of icalendar-searcher, as CalDAV has no
integer comparison; plann now requires icalendar-searcher 1.4.0
(PyCalendar/icalendar-searcher#27).

Prompt: plann select --priority ... doesn't work. We need some way to filter here, maybe --max-priority and --min-priority ? (but how to handle 0, and in what direction should max and min go? As a start, just --priority 5 for all tasks with exact priority 5 would be better than nothing)
Followup-Prompt: the filtering should go via the icalendar-search package. Please move the code there
Followup-Prompt: Are any of those covered by the roadmap? [comparison operators, an "in" operator, or both]
Followup-Prompt: Add the "in"-operator as for now, if that's the cheapest.
Followup-Prompt: (on the review finding that the icalendar_searcher dependency has no version) Pin now to the upcoming icalendar-searcher version

Assisted-By: Claude Opus 5.5 noreply@anthropic.com
Reviewed-by: Tobias Brox tobias@redpill-linpro.com

Also piggy-backing: fix: date/timestamp fix-up crashed on DUE tasks

select had no way to filter on priority.  --priority takes a number,
a range or a list (5, 1-3, 1,5-9), sidestepping the question of
whether "max" means highest number or highest importance.  0 also
matches a missing PRIORITY.  The filtering is client-side, through
the new "in" operator of icalendar-searcher, as CalDAV has no
integer comparison; plann now requires icalendar-searcher 1.4.0
(PyCalendar/icalendar-searcher#27).

Prompt: `plann select --priority ...` doesn't work.  We need some way to filter here, maybe --max-priority and --min-priority ?  (but how to handle 0, and in what direction should max and min go?   As a start, just `--priority 5` for all tasks with exact priority 5 would be better than nothing)
Followup-Prompt: the filtering should go via the icalendar-search package.  Please move the code there
Followup-Prompt: Are any of those covered by the roadmap?  [comparison operators, an "in" operator, or both]
Followup-Prompt: Add the "in"-operator as for now, if that's the cheapest.
Followup-Prompt: (on the review finding that the icalendar_searcher dependency has no version) Pin now to the upcoming icalendar-searcher version

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
select's sanity check normalises a DTSTART/DTEND pair of mixed date
and timestamp types, but always wrote to DTEND - tasks only have DUE,
giving a KeyError.  It also truncated the timed side to midnight and
left VALUE=DATE on the converted property.  Now only the date-valued
property is replaced with a midnight timestamp, in the timezone of
the other so the two can still be compared.

Prompt: (traceback pasted: `plann select --priority 6-8 --todo edit
 --postpone 14d` fails with KeyError: 'DTEND' after "task ... has
 non-matching types on dtstart and dtend/due")
Followup-Prompt: (traceback pasted: the same command now fails in
 caldav's set_due with "TypeError: can't subtract offset-naive and
 offset-aware datetimes")

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
caldav's set_due(move_dtstart=True) leaves DTSTART alone when the
duration is zero, and computes a zero duration when DTSTART is a date
on the same day as a timestamp DUE.  The task then got a duration that
grew with every postponement.  The date/timestamp normalisation from
select is now a shared helper, applied before postponing, and a zero
duration keeps DTSTART equal to the new DUE.

Prompt: I did a `plann select --priority 5-8 --todo  edit --postpone 14d` and later also a `plann select --priority 6-8 --todo  edit --postpone 14d`, so most tasks are now postponed with 28 days.  However, it seems like only the DUE was moved, while the DTSTART remained.  This gives a big problem as I'm currently using the (calculated) duration as time estimate.  Please: 1) move the DTSTART on all those tasks, 2) ensure the DTSTART is also moved when doing `edit --postpone`

Assisted-By: Claude Sonnet 5.5 / Opus 5.5 <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant