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: retain manually added Done & Cancelled dates in modal #3087

Merged

Conversation

ilandikov
Copy link
Collaborator

@ilandikov ilandikov commented Sep 19, 2024

Types of changes

Changes visible to users:

  • Bug fix (prefix: fix - non-breaking change which fixes an issue)

Internal changes:

  • Tests (prefix: test - additions and improvements to unit tests and the smoke tests)

Description

  • Done/Cancelled date have to be kept if they are already present in the respective date editor while the status is set to Done/Cancelled respectively.

Don't overwrite a user-entered Done date if changing status to DONE
Don't overwrite a user-entered Cancelled date if changing status to CANCELLED

Motivation and Context

How has this been tested?

  • new unit tests added
  • manual test in demo vault

Checklist

  • My code follows the code style of this project and passes yarn run lint.
  • My change has adequate Unit Test coverage.

Terms

@ilandikov ilandikov force-pushed the fix-keep-done-and-cancelled branch from 64e7123 to 5c83b5b Compare September 19, 2024 21:10
@ilandikov ilandikov force-pushed the fix-keep-done-and-cancelled branch from 5c83b5b to 52c4a79 Compare September 19, 2024 21:12
@ilandikov
Copy link
Collaborator Author

Sorry for late minute force push, just a comment update

@claremacrae
Copy link
Collaborator

I think I'm missing something: how do the tests verify the reported 'Steps to reproduce' are fixed?

  1. Open Edit Task modal on a task that is not Done status
  2. Set Done date to any value other than today's
  3. Change status to Done

If I understand the tests correctly, they confirm that editing a task that already has a Done date does not change the Done date, which is a different thing.

What have I misunderstood?

Copy link
Collaborator

@claremacrae claremacrae left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this.

src/ui/StatusEditor.svelte Outdated Show resolved Hide resolved
tests/ui/EditTask.test.ts Show resolved Hide resolved
tests/ui/EditTask.test.ts Outdated Show resolved Hide resolved
@ilandikov
Copy link
Collaborator Author

I think I'm missing something: how do the tests verify the reported 'Steps to reproduce' are fixed?

  1. Open Edit Task modal on a task that is not Done status
  2. Set Done date to any value other than today's
  3. Change status to Done

If I understand the tests correctly, they confirm that editing a task that already has a Done date does not change the Done date, which is a different thing.

What have I misunderstood?

As mentioned in a different comment, in today's implementation these are same, but may change in future, so I will try to create new tests that show this behaviour.

Copy link
Collaborator

@claremacrae claremacrae left a comment

Choose a reason for hiding this comment

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

I am approving this becauseI I really don't think it's worth spending any more time on it.

But it's become really quite complex code to understand and maintain now, I feel.

src/ui/StatusEditor.svelte Outdated Show resolved Hide resolved
src/ui/StatusEditor.svelte Outdated Show resolved Hide resolved
@claremacrae claremacrae added the scope: edit task The Create or edit task modal/dialog label Sep 21, 2024
@ilandikov
Copy link
Collaborator Author

ilandikov commented Sep 21, 2024

1 New issue

The issue is due to the TODO in the test. Let me know if you wish to remove the todo or the whole refernce =)

@claremacrae
Copy link
Collaborator

1 New issue

The issue is due to the TODO in the test. Let me know if you wish to remove the todo or the whole refernce =)

It's OK, I've told SonarCloud to ignore it...

Copy link

@claremacrae claremacrae changed the title fix: keep done & cancelled date if they are present when status changed to done & cancelled respectively fix: retain manually edited Done & Cancelled dates in modal Sep 21, 2024
@claremacrae claremacrae changed the title fix: retain manually edited Done & Cancelled dates in modal fix: retain manually added Done & Cancelled dates in modal Sep 21, 2024
@claremacrae claremacrae merged commit 12806c8 into obsidian-tasks-group:main Sep 21, 2024
2 checks passed
@claremacrae
Copy link
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: edit task The Create or edit task modal/dialog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Edit Task modal: switching status to Done or Cancelled changes the existing Done or Cancelled date
2 participants