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

Create cron job endpoints for anonymisation warnings #358

Merged
merged 9 commits into from
Aug 8, 2024

Conversation

faucomte97
Copy link
Contributor

@faucomte97 faucomte97 commented Jul 30, 2024

This change is Reviewable

@faucomte97 faucomte97 self-assigned this Jul 30, 2024
Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @faucomte97)


src/api/views/user.py line 347 at r1 (raw file):

        return Response()

    def _get_inactive_users(self, days: int, same_day: bool):

no need for same_day arg. always True

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @faucomte97)


src/api/views/user.py line 384 at r1 (raw file):

        )

        return teacher_queryset, independent_student_queryset

just return user_queryset directly

Code quote:

        teacher_queryset = user_queryset.filter(
            new_teacher__isnull=False,
            new_student__isnull=True,
        )
        independent_student_queryset = user_queryset.filter(
            new_teacher__isnull=True,
            new_student__class_field__isnull=True,
        )

        return teacher_queryset, independent_student_queryset

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 5 unresolved discussions (waiting on @faucomte97)


src/api/views/user.py line 434 at r1 (raw file):

        haven't been active in a while.
        """
        return self._send_verify_email_reminder(

wrong helper


src/api/views/user.py line 444 at r1 (raw file):

        haven't been active in a while.
        """
        return self._send_verify_email_reminder(

wrong helper


src/api/views/user.py line 455 at r1 (raw file):

        haven't been active in a while.
        """
        return self._send_verify_email_reminder(

wrong helper

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

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


src/api/views/user.py line 384 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

just return user_queryset directly

not exactly. just delete teacher_queryset and independent_student_queryset entirely and directly returnuser_queryset


src/api/views/user_test.py line 747 at r2 (raw file):

        )

    def _test_send_inactivity_reminder(

you don't call this helper anywhere. need to create tests for each reminder. each test should call this helper

Copy link
Contributor Author

@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.

Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @SKairinos)


src/api/views/user.py line 347 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

no need for same_day arg. always True

Done.


src/api/views/user.py line 384 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

just return user_queryset directly

Done.


src/api/views/user.py line 434 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

wrong helper

Done.


src/api/views/user.py line 444 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

wrong helper

Done.


src/api/views/user.py line 455 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

wrong helper

Done.

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

let's figure out why the tests are failing

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @faucomte97)


src/api/views/user_test.py line 761 at r3 (raw file):

            assert indy_users

            for teacher_user in teacher_users:

simplify to TeacherUser.objects.update(date_joined=date_joined)


src/api/views/user_test.py line 765 at r3 (raw file):

                teacher_user.save()

            for indy_user in indy_users:

simplify to IndependentUser.objects.update(date_joined=date_joined)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @faucomte97)


src/api/views/user_test.py line 761 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

simplify to TeacherUser.objects.update(date_joined=date_joined)

make sure to do this before you get the list of teacher users


src/api/views/user_test.py line 765 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

simplify to IndependentUser.objects.update(date_joined=date_joined)

make sure to do this before you get the list of indy users

Copy link
Contributor Author

@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.

Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @SKairinos)


src/api/views/user_test.py line 761 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

make sure to do this before you get the list of teacher users

Done.


src/api/views/user_test.py line 765 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

make sure to do this before you get the list of indy users

Done.

Copy link
Contributor

@SKairinos SKairinos 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 r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @faucomte97)


src/api/views/user_test.py line 761 at r3 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Done.

you need to do this before you get the list of teacher users


src/api/views/user_test.py line 765 at r3 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Done.

you need to do this before you get the list of indy users

Copy link
Contributor Author

@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.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @SKairinos)


src/api/views/user_test.py line 761 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

you need to do this before you get the list of teacher users

Why? We don't do that in the other helper for the verification reminders 🤔

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @faucomte97)


src/api/views/user_test.py line 761 at r3 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Why? We don't do that in the other helper for the verification reminders 🤔

so that you list the latest data. here you've update the data after caching it so the cache is immediately outdated.

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @faucomte97)


src/api/views/user_test.py line 761 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

so that you list the latest data. here you've update the data after caching it so the cache is immediately outdated.

not sure why we're not doing it other test. maybe should be done there too

Copy link
Contributor Author

@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.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @SKairinos)


src/api/views/user_test.py line 761 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

not sure why we're not doing it other test. maybe should be done there too

Done.


src/api/views/user_test.py line 765 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

you need to do this before you get the list of indy users

Done.

Copy link
Contributor

@SKairinos SKairinos 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 r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @faucomte97)

@faucomte97 faucomte97 merged commit 4cd73d7 into development Aug 8, 2024
10 of 11 checks passed
@faucomte97 faucomte97 deleted the anonymisation_warnings branch August 8, 2024 16:45
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