-
Notifications
You must be signed in to change notification settings - Fork 13
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
Show orgs with parent coalitions on hub/organization page for org leads #5594
base: main
Are you sure you want to change the base?
Conversation
Heroku app: https://gyr-review-app-5594-76e05317a479.herokuapp.com/ |
@embarnard am i supposed to see something different than this (on the deployed env)?
![]() |
|
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.
might just need to talk through some stuff b/c I'm unfamiliar with the model structure -- could tag someone else for review if we need to get this moving more quickly! I emoji-reacted on the first PR but didn't realize I had also signed up for the second lol
@@ -7,19 +7,35 @@ def initialize(current_ability) | |||
accessible_organizations = Organization.accessible_by(current_ability) | |||
@organizations = accessible_organizations.includes(:child_sites).with_computed_client_count.load | |||
@coalitions = Coalition.accessible_by(current_ability) | |||
@state_routing_targets = StateRoutingTarget.where(target: accessible_organizations).or(StateRoutingTarget.where(target: @coalitions)).load.group_by(&:state_abbreviation) | |||
coalition_parents_of_dependent_orgs = accessible_organizations.where.not(coalition_id: nil).reorder(nil).distinct.pluck(:coalition_id) |
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.
why do you need to do reorder(nil)
& distinct
needed here?
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 needed reorder
because I was getting a PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list LINE 1: ...ita_partners"."coalition_id" IS NOT NULL ORDER BY "vita_part... ^
error but I think you're right I don't need distinct
so I'll remove both
<% end %> | ||
</div> | ||
<div> | ||
<% if can? :create, Coalition %> | ||
<%= link_to t("hub.organizations.index.add_coalition"), new_hub_coalition_path, class: "button"%> | ||
<%= link_to t("hub.organizations.index.add_coalition"), new_hub_coalition_path, class: "button spacing-below-25"%> |
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.
[nit] extra space
|
||
context "with organizations that have a parent coalition" do | ||
let(:user) { create :organization_lead_user, organization: org } | ||
let!(:org) { create :organization, coalition: create(:coalition), capacity_limit: 300 } |
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.
probably want to do let!
on the user insetad of the org
since user
will create the org when it invokes the variable?
|
||
capacity = subject.state_capacity("NY") | ||
expect(capacity.current_count).to eq 0 | ||
expect(capacity.total_capacity).to eq 300 |
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.
what does the "capacity" mean in this context? Does it limit a certain organization to a total count of...clients? users?
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.
yes capacity is the number of clients a certain organization can take on; we have an assignment system to assign intakes to orgs/coalitions/sites based on capacity to make sure one doesn't get overloaded when they don't have capacity
…-srts-for-org-leads
…-srts-for-org-leads
@state_routing_targets = StateRoutingTarget.where(target: accessible_organizations) | ||
.or(StateRoutingTarget.where(target: @coalitions)) | ||
.or(StateRoutingTarget.where(target_id: coalition_parents_of_dependent_orgs)) | ||
.distinct.load.group_by(&:state_abbreviation) | ||
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 now finding organization IDs that belong to coalitions and targeting those specifically very cool
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.
those queries are intense but this really cleans up the rendering
Link to pivotal/JIRA issue
Is PM acceptance required? (delete one)
Reminder: merge main into this branch and get green tests before merging to main
What was done?
How to test?
[email protected]
)/hub/organizations
pageScreenshots (for visual changes)