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

Allow chapter ambassadors to view any participant in their region #5377

Merged
merged 7 commits into from
Feb 12, 2025

Conversation

shaun-technovation
Copy link
Contributor

@shaun-technovation shaun-technovation commented Feb 10, 2025

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

@shaun-technovation shaun-technovation force-pushed the 5300-allow-chas-to-view-participants-in-region branch from 77ac899 to 6ec4cee Compare February 11, 2025 17:41
@shaun-technovation shaun-technovation changed the title WIP: Allow chapter ambassadors to view any participant in their region Allow chapter ambassadors to view any participant in their region Feb 11, 2025
}
)
.find(params[:id])
if params[:search_in_region].present?
Copy link
Contributor Author

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.

Copy link
Contributor

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)
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

Copy link
Contributor

@viviancan viviancan left a 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!

@shaun-technovation shaun-technovation force-pushed the 5300-allow-chas-to-view-participants-in-region branch from 6ec4cee to 32f1d63 Compare February 12, 2025 21:43
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
@shaun-technovation shaun-technovation force-pushed the 5300-allow-chas-to-view-participants-in-region branch from 32f1d63 to 5a1add9 Compare February 12, 2025 21:44
@shaun-technovation shaun-technovation merged commit 05a630a into qa Feb 12, 2025
1 check was pending
@shaun-technovation shaun-technovation deleted the 5300-allow-chas-to-view-participants-in-region branch February 12, 2025 21:45
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.

2 participants