Commit 706736c2 authored by Alexandre Friquet's avatar Alexandre Friquet

Only display medicosocial orgs with subscriptions: refs #59.

parent 0b50cb7b
......@@ -24,7 +24,12 @@ class PlatformController < ApplicationController
def index
@collaborating_clubs = Member.of_member_groups(settings.platform_collaborating_clubs).by_name
@orgs_in_db = Member.of_member_groups(settings.platform_medicosocial_orgs).by_name
@orgs_in_db_by_name = Member.of_member_groups(settings.platform_medicosocial_orgs).by_name
@orgs_in_db = {}
@orgs_in_db_by_name.each do |org|
subscriptions = Subscription.of_medicosocial_org(org).by_adherent_name
@orgs_in_db[org] = subscriptions unless subscriptions.empty?
end
@orgs_not_in_db = {}
Adherent.where.not(other_medicosocial_org: nil).group(:other_medicosocial_org).order(:other_medicosocial_org).count.each do |org_name, result|
@orgs_not_in_db[Member.new({name: org_name})] = Subscription.joins(:adherent).where(adherents: {other_medicosocial_org: org_name}).by_adherent_name.all
......
<li>
<%= custom_edit_link edit_member_subscription_path(subscription.member, subscription), :short, class: %w(tight) %>
<%= custom_delete_link member_subscription_path(subscription.member, subscription), :short, class: %w(tight) %>
<%= internal_subscription_label(subscription) %>
</li>
......@@ -22,7 +22,6 @@
%>
<% title "Plateforme Sports et Troubles psychiques" %>
<div class="tabs">
<ul>
<li><a href="#subscriptions-by-club">Adhésions par club</a></li>
......@@ -58,19 +57,13 @@
<span><%= Statistics::Pass::Global.new(@orgs.to_a).label %></span>
</h2>
<h3>Structures référencées</h3>
<%- @orgs_in_db.each do |org| %>
<%- @orgs_in_db.each do |org, subscriptions| %>
<h4>
<%= org.name %>
<span><%= Statistics::Pass::Unit.new(org).label %></span>
</h4>
<ul id="member-<%= org.id %>">
<%- Subscription.of_medicosocial_org(org).by_adherent_name.each do |subscription| %>
<li>
<%= custom_edit_link edit_member_subscription_path(subscription.member, subscription), :short, class: %w(tight) %>
<%= custom_delete_link member_subscription_path(subscription.member, subscription), :short, class: %w(tight) %>
<%= internal_subscription_label(subscription) %>
</li>
<%- end %>
<%= render partial: 'subscription', collection: subscriptions %>
</ul>
<%- end %>
<h3>Structures non référencées</h3>
......@@ -80,13 +73,7 @@
<span><%= Statistics::Pass::Unit.new(org).label %></span>
</h4>
<ul id="member-<%= org.name.crypt('name').gsub('/','') %>">
<%- subscriptions.each do |subscription| %>
<li>
<%= custom_edit_link edit_member_subscription_path(subscription.member, subscription), :short, class: %w(tight) %>
<%= custom_delete_link member_subscription_path(subscription.member, subscription), :short, class: %w(tight) %>
<%= internal_subscription_label(subscription) %>
</li>
<%- end %>
<%= render partial: 'subscription', collection: subscriptions %>
</ul>
<%- end %>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment