-
Notifications
You must be signed in to change notification settings - Fork 4
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
Allow chapter ambassadors to view any participant in their region #5377
Allow chapter ambassadors to view any participant in their region #5377
Conversation
77ac899
to
6ec4cee
Compare
} | ||
) | ||
.find(params[:id]) | ||
if params[:search_in_region].present? |
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.
This is the new URL parameter I added search_in_region
, open to changing that. If that's present it will use the old in_region
functionality.
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.
I think the naming is clear 👍
|
||
@teams = Team | ||
.current | ||
.in_region(current_ambassador) |
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.
This will display teams (for team assignment) based on their region.
current_ambassador.chapterable_type, | ||
current_ambassador.current_chapterable.id | ||
) | ||
.distinct |
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.
And this will display teams for their chapter or club (addressing the feedback in #5363).
@@ -508,6 +508,16 @@ def chapter_ambassador | |||
.where("background_checks.status = ?", BackgroundCheck.statuses[:suspended]) | |||
} | |||
|
|||
scope :by_chapterable, ->(chapterable_type, chapterable_id) do |
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.
Created a new by_chapterable
scope here to match our other ones.
|
||
def secondary_regions | ||
[] | ||
end |
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.
This is needed for the in_region
search.
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.
LGTM 💯 Nice updates with this!
6ec4cee
to
32f1d63
Compare
This will let club ambassadors assign a student or a mentor to a team. Chapter ambassadors already had this functionality, to make it work for club ambassadors I extracted the existing functionality and made it so that both chapter ambassadors and club ambassadors can share the same functionality. Refs: #5331
This will bring back the functionality that will let chapter ambassadors view any participant in their region. It works by adding a `search_in_region` URL parameter, if this URL parameter is present, it will use the old `.in_region` functionality to find participants. Refs: #5300
Addressing formatting issues. Refs: #5300
When an ambassador assigns a participant to a team, we want to restrict which teams are displayed. - If an ambassador is viewing a participant in their region we'll display all of the teams in their region - Otherwise we'll only display teams that belong to their chapter or club Refs: #5378
This will address a Bullet gem warning about including :mentor_profile. Refs: #5300
Creating this scope to make it consistent with our other main Rails models, like `Team` and `TeamSubmission`. Refs: #5300
32f1d63
to
5a1add9
Compare
This will bring back the functionality that will let chapter ambassadors view any participant in their region. It works by adding a
search_in_region
URL parameter, if this URL parameter is present, it will use the old.in_region
functionality to find participants.Also, when an ambassador assigns a participant to a team, this will restrict which teams are displayed (to select from):
If an ambassador is viewing a participant in their region we'll display all of the teams in their region
Otherwise we'll only display teams that belong to their chapter or club