Skip to content
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

Fix fatal error in untouched tasks plugin #927

Merged
merged 2 commits into from
Oct 15, 2022

Conversation

APCBoston
Copy link
Contributor

@APCBoston APCBoston commented Sep 18, 2022

Fixes #926 . Fixes #912 .

Changes today in untouchedTasks.add_untouched_tag() to be a datetime.date instead of a datetime.datetime, making the comparison at line 114 (which was previously throwing an exception) valid.

…tion at line 114, if new_time < today. New GTG.core.dates.Date does not define < operand with a datetime.datetime object, but it is defined with a datetime.date.
@Neui
Copy link
Contributor

Neui commented Sep 18, 2022

Not fixed for me because new_time might be a datetime.datetime object depending how it was stored.
See #912 (comment) for more info.

Possible fix in my view:

The fix should either be using dt_by_accuracy(Accuracy.datetime) in untouchedTasks, or just always return an datetime in get_modified() (especially since fuzzy dates and different datetime formats aren't useful there).

Edit: You might also want to follow https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue to auto-close the issues with the correct syntax. You only need to write that in the PR description.

@APCBoston
Copy link
Contributor Author

Thanks for those comments. It does seem like get_modified() should always return a single type. That said, for the sake of fixing the plugin before refactoring the core, I added a quick check to make sure new_time is always a core.Date or datetime.date, both of which can be validly compared. If it's a datetime.datetime, the datetime.datetime.date() method returns a datetime.date.

With this change I can't get it to fail with either type of return date from get_modified()

@APCBoston APCBoston changed the title Fixed error in add_untouched_tag that was throwing a ValueError excep… Fix fatal error in untouched tasks plugin Sep 19, 2022
@diegogangl
Copy link
Contributor

@APCBoston thanks for the patch! We're in the middle of a giant (and messy) port ATM. I'll wait until #894 is ready to land to check and merge this PR (and then fix the conflicts in the other pr).

@diegogangl diegogangl merged commit a4683c6 into getting-things-gnome:master Oct 15, 2022
@APCBoston APCBoston deleted the APCEdits branch November 30, 2022 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants