Skip to content

Fixes a bug in completing future tasks #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

chuck-flowers
Copy link
Contributor

Updates the repeater logic so that tasks which are completed before
their deadline has been reached, will properly repeat forward.

Updates the repeater logic so that tasks which are completed before
their deadline has been reached, will properly repeat forward.
@kristijanhusak
Copy link
Member

Can you please give an example? I'm not sure what's the difference between old and new code.

@chuck-flowers
Copy link
Contributor Author

chuck-flowers commented Dec 13, 2022

The issue that I've run into recently is that I have tasks for buying Christmas presents for friends and family. I have the DEADLINE for these TODOs set to <2022-12-25 Sun ++1y -40d>. I've already bought some of these presents so I'd like to mark them as complete using cit.

In the old logic, an entry would be made in the logbook but the deadline would not be updated because the while loop which incremented the DEADLINE date would increment only while the deadline was less than today. Since today is before the current DEADLINE no actual incrementing of the DEADLINE would occur.

Now with my new logic, at least one increment will occur before the condition of the while loop is checked. Essentially it's the difference between a while loop and a do ... while loop from other C-like languages. So now when I cit these Christmas present headlines, they are updated to <2023-12-25 Mon ++1y -40d> just like they are in Emacs.

I should note that for my emacs testing, I'm using the official emacs package as its distributed in Arch Linux in case that makes a difference.

EDIT: Fixed some typos

@chuck-flowers
Copy link
Contributor Author

This commit also includes some slight changes and additional comments to the relevant code to help the next programmer understand more quickly what this code is doing.

@kristijanhusak
Copy link
Member

Thanks for the explanation. It is indeed a bug. Could you also please add a test case for this in the date_spec, somewhere around here?

@chuck-flowers
Copy link
Contributor Author

I've added a test as requested. It's the first Lua test I've ever had to write so please don't hesitate to let me know if any adjustments should be made.

Copy link
Member

@kristijanhusak kristijanhusak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test looks good, just a minor tweak and it's good to go.

Copy link
Member

@kristijanhusak kristijanhusak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks great now, thanks!

@kristijanhusak kristijanhusak merged commit dadf563 into nvim-orgmode:master Dec 13, 2022
@chuck-flowers chuck-flowers deleted the complete-future-tasks branch December 13, 2022 20:25
SlayerOfTheBad pushed a commit to SlayerOfTheBad/orgmode that referenced this pull request Aug 16, 2024
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.

2 participants