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

Add the first set of unit tests #4

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Add the first set of unit tests #4

wants to merge 14 commits into from

Conversation

akirk
Copy link
Member

@akirk akirk commented Dec 3, 2024

This restructures the code a little by invoking notification actions via WordPress hooks.

Then it adds unit tests for the different user engagements.

Run with composer test.

@akirk akirk changed the title Add unit tests Add first set of unit tests Dec 3, 2024
@akirk akirk marked this pull request as ready for review December 3, 2024 15:58
@akirk akirk requested a review from amieiro December 3, 2024 15:58
@akirk
Copy link
Member Author

akirk commented Dec 3, 2024

@amieiro I am worried about the get_users_and_first_translation_date() function. It will be very slow.

I think we should change the approach:

  1. Get the unique user_ids from the translations table.
  2. For each user, query:
    1. If they have their first translation date in the user option use that.
    2. Otherwise query it from the translations table and save it in a user option.
    3. If the date ends in month-day, keep the user
  3. Now we have all users with an anniversary date and can sort it into years.

It will be slow on the first run but on subsequent runs only the first translation needs to be calculated for new users.

@akirk akirk changed the title Add first set of unit tests Add the first set of unit tests Dec 11, 2024
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.

1 participant