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

Archival #538

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open

Archival #538

wants to merge 12 commits into from

Conversation

lukasjuhrich
Copy link
Collaborator

@lukasjuhrich lukasjuhrich commented Feb 21, 2022

Prepares #490

  • Discuss whether we want to do this yearly or regularly && adapt code accordingly
  • Test archival selection
    • test select_user_and_last_mem() select (used as CTE)
    • test cutoff filtering
    • test cutoff calculation from current date
    • test do-not-archive filtering
  • Implement archive_users (cleanup)
  • Add a web endpoint and button archiving all current users
  • Add a celerybeat task executing the archival

@lukasjuhrich
Copy link
Collaborator Author

This PR, as of now, does some base work that can directly be merged into develop.
All the rest can be coordinated in one or multiple different PRs (see the extended tasklist of #67).
Waiting for the tests to finish.

@lukasjuhrich lukasjuhrich marked this pull request as ready for review January 15, 2023 18:05
@lukasjuhrich lukasjuhrich changed the title Archival Archival preparations Jan 15, 2023
def get_invalidated_archive_memberships() -> list[Membership]:
"""Get all memberships in `to_be_archived` of users who have an active `do-not-archive` property.
Selected are those users
- whose last membership in the member_group ended two weeks in the past,
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks do me like we are now testing for >= 2 years and not weeks.

Introduces `select_users_and_last_mem` returning the `select`
This suits the relational algebra pipeline better, as the entities we
select from actually correspond to a projection done after all the
joins and filtering.

This change does not alter the compilation result of this select statement.
Fixes an oversight in the previous implementation of #470

Also, expand on the test suite substantially while retaining a decent
runtime.

Refs #67
1. We restrict the ranges to a smaller subset which is still
   meaningful.
2. We use the `select` statement itself rather than the wrapper method
   adding a ton of `joinedload`s.
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