-
Notifications
You must be signed in to change notification settings - Fork 22
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 class #262
Create class #262
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 8 of 10 files at r1, all commit messages.
Reviewable status: 8 of 10 files reviewed, 5 unresolved discussions (waiting on @SKairinos)
backend/api/serializers/klass.py
line 16 at r1 (raw file):
# pylint: disable-next=missing-class-docstring,too-many-ancestors class ClassSerializer(_ClassSerializer): teacher = serializers.IntegerField(
Make teacher not required, grab request.user.teacher if teacher is non-admin
backend/api/serializers/klass.py
line 20 at r1 (raw file):
) school = serializers.IntegerField(
Remove this field and automatically assign the school to be the teacher's school
backend/api/serializers/klass.py
line 62 at r1 (raw file):
access_code = get_random_string( length=5, allowed_chars=string.ascii_uppercase + string.digits,
Remove digits
backend/api/tests/serializers/test_klass.py
line 23 at r1 (raw file):
self.class_1 = Class.objects.get(name="Class 1 @ School 1") def test_validate_name__name_not_unique(self):
Add test to check admin teacher can't create a class for teacher outside of school
backend/api/tests/views/test_klass.py
line 83 at r1 (raw file):
) def test_create(self):
Add a test checking that admin teacher can successfully create a class for a different teacher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 8 of 10 files reviewed, 6 unresolved discussions (waiting on @SKairinos)
backend/Pipfile
line 31 at r1 (raw file):
google-cloud-container = "==2.3.0" # "django-anymail[amazon_ses]" = "==7.0.*" codeforlife = {ref = "create_class", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
update package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 8 of 10 files reviewed, 6 unresolved discussions (waiting on @faucomte97)
backend/Pipfile
line 31 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
update package
Done.
backend/api/serializers/klass.py
line 16 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Make teacher not required, grab request.user.teacher if teacher is non-admin
Done.
backend/api/serializers/klass.py
line 20 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Remove this field and automatically assign the school to be the teacher's school
Done.
backend/api/serializers/klass.py
line 62 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Remove digits
Done.
backend/api/tests/serializers/test_klass.py
line 23 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Add test to check admin teacher can't create a class for teacher outside of school
Done.
backend/api/tests/views/test_klass.py
line 83 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Add a test checking that admin teacher can successfully create a class for a different teacher
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 10 files at r1, 6 of 6 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @SKairinos)
backend/api/serializers/klass.py
line 46 at r2 (raw file):
user = self.request_school_teacher_user if not queryset.filter(school=user.teacher.school_id).exists():
This seems to just check whether the request teacher's school exists (which it always will).
Instead, shouldn't this check whether value != user.teacher.school_id
?
backend/api/tests/views/test_klass.py
line 85 at r2 (raw file):
def test_create__self(self): """ Teacher can create a class with their self as the class owner.
themself
There was a problem hiding this 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)
backend/api/serializers/klass.py
line 46 at r2 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
This seems to just check whether the request teacher's school exists (which it always will).
Instead, shouldn't this check whethervalue != user.teacher.school_id
?
Not quite. The original queryset checks if the teacher exists at all
queryset = Teacher.objects.filter(id=value)
Then we further filter by school to check if the teacher exists in the specific school
queryset.filter(school=user.teacher.school_id).exists()
backend/api/tests/views/test_klass.py
line 85 at r2 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
themself
Done.
There was a problem hiding this 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: complete! all files reviewed, all discussions resolved (waiting on @SKairinos)
This change is