Closed SKairinos closed 6 months ago
backend/api/serializers/klass.py
line 35 at r1 (raw file):
Shall we do just `school` instead of `school_id`?
Generally speaking, it's more efficient to compare 2 related objects by their iIDs as you avoid fetching the related objects from the db. Also it does the same equality comparison under the hood anyway so it's logically the same check.
This will not call the db to fetch the school objects and check the ids
value.school_id != user.teacher.school_id
This call the db to fetch the 2 school objects (so 2 db calls) and then check the ids (under the hood it's doing value.school.id != user.teacher.school.id
)
value.school != user.teacher.school
This change is![Reviewable](https://reviewable.io/review_button.svg)