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

Edit Modal ignores edits to cancelled date #3089

Closed
2 of 7 tasks
ilandikov opened this issue Sep 21, 2024 · 13 comments · Fixed by #3099
Closed
2 of 7 tasks

Edit Modal ignores edits to cancelled date #3089

ilandikov opened this issue Sep 21, 2024 · 13 comments · Fixed by #3099
Assignees
Labels
scope: edit task The Create or edit task modal/dialog type: bug Something isn't working

Comments

@ilandikov
Copy link
Collaborator

ilandikov commented Sep 21, 2024

Please check that this issue hasn't been reported before.

  • I searched previous Bug Reports didn't find any similar reports.

Expected Behavior

In Edit Modal setting status to cancelled and setting canceled date to any non today's date and clicking Apply button should save the task with the input cancelled date.

Example:

today is 2024-09-01
I set status to cancelled, the cancelled date is 2024-09-01, I set the cancelled date to any other date -> the task is saved with 2024-09-01 as cancelled date

Current behaviour

In Edit Modal setting status to cancelled and canceled date to any non today's date and clicking Apply button saves the task with today's cancelled date.

Example:

today is 2024-09-01
I set status to cancelled, the cancelled date is 2024-09-01, I set the cancelled date to 2022-02-02 -> the task is saved with 2022-02-02 as cancelled date

Steps to reproduce

  1. Open Edit Task modal on an existing task - [ ] #task todo (Global filter is set to #task)
  2. Set status to Cancelled (THIS IS THE IMPORTANT STEP, IF OMITTED, EVERYTHING WORKS FINE)
  3. Set cancelled date to any date than today's date
  4. Click Apply

Which Operating Systems are you using?

  • Android
  • iPhone/iPad
  • Linux
  • macOS
  • Windows

Obsidian Version

1.7.1

Tasks Plugin Version

7.10.0

Checks

  • I have tried it with all other plugins disabled and the error still occurs

The cancelled date is enabled in the settings.

Possible solution

No response

@ilandikov ilandikov added type: bug Something isn't working scope: edit task The Create or edit task modal/dialog labels Sep 21, 2024
@claremacrae
Copy link
Collaborator

I don't fully understand.

Does it matter whether the Cancelled date is enabled or disabled in settings?

Does the problem occur in 7.9.0?

I wonder whether this is related to either of these:

@ilandikov
Copy link
Collaborator Author

I was unclear. There can be a relationship, but this is a different bug/behaviour.

I tried to clarify by adding examples in the description. Let me know if it is still unclear.

The cancelled date is enabled in the settings.

@claremacrae
Copy link
Collaborator

claremacrae commented Sep 21, 2024

Thanks.

This is odd:

image

I asked about 7.9.0 in case I broke the code with the addition of the (disabled) date-picker button...

@ilandikov
Copy link
Collaborator Author

Fixed, thanks.

I will try 7.9.0 and keep you posted.

@claremacrae
Copy link
Collaborator

Edit Modal ignores cancel date

It does edit it under some circumstances.

@claremacrae
Copy link
Collaborator

... such as if I edit a task that is cancelled, and change the Cancelled date, the edit is preserved.

@ilandikov
Copy link
Collaborator Author

It does edit it under some circumstances.

Right, I found that the thing that exposes the bug is a status change from non-cancelled to cancelled.

@claremacrae
Copy link
Collaborator

That would be good to include in the Steps to Reproduce, ideally by giving a markdown line to edit, to avoid ambiguity when testing.

@ilandikov
Copy link
Collaborator Author

Done

@claremacrae
Copy link
Collaborator

claremacrae commented Sep 22, 2024

Steps to reproduce

  1. Open Edit Task modal
  2. Set status to Cancelled (THIS IS THE IMPORTANT STEP, IF OMITTED, EVERYTHING WORKS FINE)
  3. Set cancelled date to any date than today's date
  4. Click Apply

I cannot reproduce the problem with following these steps, because Apply is disabled due to the empty description.

I generally request that users provide a Markdown line in a code-block that can be copied-and-pasted in to a markdown file, so we can copy that line, and know that we are always consistently starting the reproduction from the exact same point.

@ilandikov
Copy link
Collaborator Author

My bad, added additional info

@claremacrae
Copy link
Collaborator

Perfect. Thanks.

@claremacrae
Copy link
Collaborator

This is the code that enables manual edits to the Done date to be preserved by the Edit Task modal, if the user edits the Done date after changing the status:

// Then apply the new status to the updated task, in case a new recurrence
// needs to be created.
// If there is a 'done' date, use that for today's date for recurrence calculations.
// Otherwise, use the current date.
const today = doneDate ? doneDate : window.moment();
return updatedTask.handleNewStatusWithRecurrenceInUsersOrder(this.status, today);

Indeed, the workaround for the bug is to set the required Cancelled date in the modal's Done date field.

So the fix is going to be something like:

  • If the new status type is DONE, use the Done date for today
  • If the new status type is CANCELLED, use the Cancelled date for today

@claremacrae claremacrae changed the title Edit Modal ignores cancel date Edit Modal ignores edits to cancelled date Sep 24, 2024
@claremacrae claremacrae self-assigned this Sep 24, 2024
claremacrae added a commit that referenced this issue Sep 24, 2024
…-date

fix: Edit Task modal now retains edits to Cancelled date

Fixes #3089.
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 type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants