Files
grecia/app/views/shared/stats/_geozone.html.erb
Javi Martín 793bfed372 Display only existing stats
So if we don't have information regarding gender, age or geozone, stats
regarding those topics will not be shown.

Note we're using `spec/models/statisticable_spec.rb` because having the
same file in `spec/models/concerns` caused the tests to be executed
twice.

Also note the implementation behind the `gender?`, `age?` and `geozone?`
methods is a bit primitive. We might need to make it more robust in the
future.
2019-05-21 13:50:18 +02:00

24 lines
697 B
Plaintext

<div id="participants_by_geozone" class="stats-group">
<h4><%= t("stats.by_geozone") %></h4>
<table>
<thead>
<tr>
<th><%= t("stats.geozone") %></th>
<th><%= t("stats.total") %></th>
<th><%= t("stats.geozone_participation") %></th>
</tr>
</thead>
<tbody>
<% stats.participants_by_geozone.each do |geozone, participants| %>
<tr>
<td><%= geozone %></td>
<td><%= "#{participants[:total][:count]} (#{number_to_stats_percentage(participants[:total][:percentage])})" %></td>
<td><%= number_to_stats_percentage(participants[:percentage]) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>