-
Notifications
You must be signed in to change notification settings - Fork 14
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
Refactor the role filtering parameter to be a tuple #7020
base: main
Are you sure you want to change the base?
Conversation
All method that return a query of users or a roster take a role scope and a role type parameter. Refactor that to be a tuple of values instead. This is to accommodate a future change to add new parameter to "exclude" a certain type of role. This refactor is big enough that deserves its own commit to make it easier to review.
@@ -219,8 +219,7 @@ def get_assignment_roster( | |||
# If rostering is enabled and we do have the data, use it | |||
query = self._roster_service.get_assignment_roster( | |||
assignment, | |||
role_scope=RoleScope.COURSE, | |||
role_type=RoleType.LEARNER, | |||
include_role=(RoleScope.COURSE, RoleType.LEARNER), |
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.
Most of the changes is this, from two parameters to a tuple.
I might create a type alias when we add exclude_role
.
select(LTIRole.id).where( | ||
LTIRole.scope == role_scope, LTIRole.type == role_type | ||
) | ||
self._filter_membership_by_role_clause( |
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.
Adding a small helper function here to avoid a bit duplication.
Again, this will make more sense once we add exclude_role
, the helper function will do the filtering for both.
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.
👍
For:
All method that return a query of users or a roster take a role scope and a role type parameter.
Refactor that to be a tuple of values instead.
This is to accommodate a future change to add new parameter to "exclude" a certain type of role.
This refactor is big enough that deserves its own commit to make it easier to review.
Testing
There should not be any functional changes, for sanity checking navigate around the dashboards.