Campaign metrics on campaign listing page now include child campaign metrics

This commit is contained in:
Eric Schultz 2018-11-19 16:15:56 -06:00
parent 27877a716c
commit ab773ee48f

View file

@ -1,6 +1,8 @@
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
<table class='table--striped u-marginBottom--0'>
<% campaigns.each do |campaign |%>
<% campaigns.each do |campaign|%>
<% metric = QueryCampaignMetrics.on_donations(campaign.id) %>
<tr>
<td class='u-padding--0 u-width--200 u-hideIf--400'>
<img src='<%= campaign.main_image_url(:normal) %>'>
@ -18,11 +20,11 @@
<small><%= campaign.summary ? strip_tags(campaign.summary) : strip_tags(campaign.tagline) %></small>
</p>
<% if campaign.show_total_count %>
<span class='pastelBox--white u-padding--3'><%= campaign.donations.count %> <small>supporters</small></span>
<span class='pastelBox--white u-padding--3'><%= metric['supporters_count'] %> <small>supporters</small></span>
<% end %>
<% if campaign.show_total_raised %>
<span class='pastelBox--white u-padding--3'>
<%= print_currency campaign.total_raised, campaign.nonprofit.currency_symbol %> <small>raised</small>
<%= print_currency metric['total_raised'], campaign.nonprofit.currency_symbol %> <small>raised</small>
</span>
<% end %>
</td>