Skip to content

feat: select --priority - #90

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

tobixen wants to merge 2 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

tobixen added a commit that referenced this pull request Nov 22, 2026
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 fix-up that select
runs (_fix_mismatched_date_types) moves to plann/lib.py and is applied
before postponing too, and a zero duration keeps DTSTART equal to the
new DUE.  So does a negative one: west of UTC, a date next to an early
UTC DUE becomes a local midnight after the DUE.

Prompts:
> 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`

> Go for the updated recommendations. [= among them: drop this branch's
> own date/timestamp fix in favour of the one merged from PR 91]

> then rebase [#90] onto it [=
> onto master with #91 merged]

Assisted-By: Claude Sonnet 5.5 / Opus 5.5 <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
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>
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 fix-up that select
runs (_fix_mismatched_date_types) moves to plann/lib.py and is applied
before postponing too, and a zero duration keeps DTSTART equal to the
new DUE.  So does a negative one: west of UTC, a date next to an early
UTC DUE becomes a local midnight after the DUE.

Prompts:
> 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`

> Go for the updated recommendations. [= among them: drop this branch's
> own date/timestamp fix in favour of the one merged from PR 91]

> then rebase [#90] onto it [=
> onto master with #91 merged]

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

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