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

Clean up local tasks #200

Merged
merged 6 commits into from
Dec 25, 2024
Merged

Clean up local tasks #200

merged 6 commits into from
Dec 25, 2024

Conversation

ilicfilip
Copy link
Collaborator

@ilicfilip ilicfilip commented Dec 23, 2024

Context

For some type of suggested tasks (create new short / long post, update core) we use year and week as part of their ID - this way we can generate new tasks of the same type periodically and also prevent user to do the same task infinite number of times during the same week (ie to create long / short repeatedly).

For #163 I changed format of the update-core task to include year and week, but I haven't updated all the checks properly - so the update-core task is added to the local (suggested) tasks list again when the next week starts. It is not visible to the user (it is not displayed in the widget) but upon completion 2 update tasks would be struck through and user would get 2 points.

On the other side, create new short / long post had a check if completed task(s) was generated within the current week, so points are awarded correctly, but with the same problem of task(s) of the same type being internally added when new week starts.

I have looked into several ways on how to fix this and the least invasive and IMO the best approach is to:

  • add a check for completed update-core tasks if they were generated in the current week (like we had for create post tasks)
  • add a cleanup method which will remove uncompleted tasks which were generated in the previous week (this runs once a day)

Summary

This PR can be summarized in the following changelog entry:

Remove duplicate weekly suggested tasks.

Quality assurance

  • I have tested this code to the best of my abilities.
  • I have added unit tests to verify the code works as intended.
  • I have checked that the base branch is correctly set.

Copy link
Contributor

github-actions bot commented Dec 23, 2024

Test on Playground
Test this pull request on the Playground or download the zip.

@ilicfilip
Copy link
Collaborator Author

One more thing, probably this is a good place to discuss - For every task we have unique ID, for example:

  • For create posts or update core it is the year and week suffix
  • For update posts it is the post ID
  • For remote tasks it is the ID of the task on the server side

This makes sense since ID should be unique, but we also have some tasks which IMO dont require it, like "Fill the settings page' (which has year and week suffix as well).

Currently it does not make the difference, but in the future we will have more similar tasks (ie "Yoast: Set organization logo") and if the task ID contains such suffix it means user can (theoretically) unset & set a setting to earn points every week.

@ilicfilip ilicfilip requested a review from jdevalk December 25, 2024 08:45
@jdevalk jdevalk merged commit 1356bce into develop Dec 25, 2024
18 checks passed
@jdevalk jdevalk deleted the filip/clean-up-local-tasks branch December 25, 2024 09:43
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