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: add migration to clean class data #2332

Merged
merged 9 commits into from
Jul 31, 2024
Merged

fix: add migration to clean class data #2332

merged 9 commits into from
Jul 31, 2024

Conversation

evemartin
Copy link
Contributor

@evemartin evemartin commented Jul 30, 2024

This change is Reviewable

Copy link
Contributor

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @evemartin)


cfl_common/common/migrations/0053_clean_class_data.py line 4 at r2 (raw file):

from django.db import migrations, models

def clean_dirty_data(apps: Apps, *args):

Please give this a more descriptive name (the file name itself might be good enough)


cfl_common/common/migrations/0053_clean_class_data.py line 8 at r2 (raw file):

    Class.objects.filter(
        creation_time__year=2015

Let's actually make a migration that clears the creation time for any class that has a creation time earlier than the day we started tracking it (you should be able to check when the migration was made that adds the creation_time field, that'll be the day we need to filter before).

I know it doesn't look like we have any classes other than those 16 in 2015 but let's still do that just in case.

Copy link
Contributor

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @evemartin)


cfl_common/common/migrations/0053_clean_class_data.py line 8 at r3 (raw file):

    Class.objects.filter(
        creation_time__date__gt = datetime.date(2021, 10, 15)

Needs to be lt not gt 🙃

@evemartin
Copy link
Contributor Author

I have now successfully tested this on Dev!

Copy link
Contributor

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @evemartin)

@evemartin evemartin merged commit 2777025 into master Jul 31, 2024
7 checks passed
@evemartin evemartin deleted the clean-class-data branch July 31, 2024 12:44
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