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: Allow requester indies to retrieve school #147

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

Conversation

faucomte97
Copy link
Contributor

@faucomte97 faucomte97 commented Nov 20, 2024

This change is Reviewable

@faucomte97 faucomte97 self-assigned this Nov 20, 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.

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


codeforlife/user/views/school_test.py line 75 at r1 (raw file):

        to join.
        """
        user = IndependentUser.objects.get(username="indy.requester@email.com")

to make the code more resilient and readable, get the first instance of an object that matches your testing conditions.

generally not good practice to refer to test data by a unique identifier and assume the data meets the conditions your test needs.

user = IndependentUser.objects.filter(...an indy user that is requesting to join a class...).first()

codeforlife/user/views/school.py line 35 at r1 (raw file):

        user = self.request.auth_user
        if user.student:
            if user.student.class_field:

no need to do this if check. delete this if check and then put the if check: if user.student.pending_class_request: before this return.

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)


codeforlife/user/views/school.py line 35 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

no need to do this if check. delete this if check and then put the if check: if user.student.pending_class_request: before this return.

Done.


codeforlife/user/views/school_test.py line 75 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

to make the code more resilient and readable, get the first instance of an object that matches your testing conditions.

generally not good practice to refer to test data by a unique identifier and assume the data meets the conditions your test needs.

user = IndependentUser.objects.filter(...an indy user that is requesting to join a class...).first()

Done.

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.

student dashboard - /independent/join
2 participants