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

Desktop: Fix importing completed tasks #10528

Merged

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Jun 1, 2024

Summary

Previously, tasks with completed?: yes were imported as incomplete tasks (with completed_time: 0). This was caused by incorrect use of JavaScript's in with arrays.

This pull request fixes an issue observed while testing #10448.

Testing

This pull request adds two new automated tests:

  • A test that covers the case where a task has completed?: yes and there is no user_updated_time.
  • A test that covers the case where completed? is not present (the note is not a task).
    • None of the existing tests check that is_todo is 0 after importing.

The case where completed? is false is tested by 'should import file and set all metadata correctly'.

metadata['todo_completed'] = metadata['user_updated_time'];
metadata['todo_completed'] = metadata['user_updated_time'] ?? Date.now();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Previously, if updated_time wasn't set, todo_completed would be set to undefined. This resulted in tasks being marked as incomplete, even if completed? was set to yes.

@laurent22 laurent22 merged commit 0938dc9 into laurent22:dev Jun 4, 2024
10 checks passed
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