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.
This commit is contained in:
28
app/views/shared/stats/_age.html.erb
Normal file
28
app/views/shared/stats/_age.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<div id="participants_by_age" class="stats-group">
|
||||
<h4><%= t("stats.by_age") %></h4>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="small-4"><%= t("stats.age") %></th>
|
||||
<th><%= t("stats.total") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% stats.participants_by_age.values.each do |group| %>
|
||||
<tr>
|
||||
<td><%= group[:range] %></td>
|
||||
<td>
|
||||
<strong>
|
||||
<%= "#{group[:count]} (#{number_to_stats_percentage(group[:percentage])})" %>
|
||||
</strong>
|
||||
<div class="progress" tabindex="0">
|
||||
<span class="progress-meter" style="width: <%= group[:percentage] %>%"></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
Reference in New Issue
Block a user