diff --git a/app/views/lotteries/_acceptance_stats.html.erb b/app/views/lotteries/_acceptance_stats.html.erb new file mode 100644 index 000000000..8c0a0bfb5 --- /dev/null +++ b/app/views/lotteries/_acceptance_stats.html.erb @@ -0,0 +1,46 @@ +<%# locals: (presenter:) %> + +<% presenter.stats.each do |division_name, division_stats| %> +
+

<%= "#{division_name}" %>

+
+ <%= column_chart presenter.stats_chart_data(division_stats), + stacked: true, + xtitle: "Number of Tickets", + ytitle: "Entrants", + colors: ["#28a745", "#3A9DD1", "#bbb"] %> + +
+ + + + + + + + + + + + + + + + <% division_stats.each do |division_stat| %> + + + + + + + + + + + <% end %> + +
EntrantsAccepted%Waitlisted%Not Drawn%
<%= pluralize(division_stat.number_of_tickets, "Ticket") %><%= division_stat.entrants_count %><%= division_stat.accepted_entrants_count %><%= (division_stat.accepted_entrants_count.to_f / division_stat.entrants_count * 100).round(1) %><%= division_stat.waitlisted_entrants_count %><%= (division_stat.waitlisted_entrants_count.to_f / division_stat.entrants_count * 100).round(1) %><%= division_stat.undrawn_entrants_count %><%= (division_stat.undrawn_entrants_count.to_f / division_stat.entrants_count * 100).round(1) %>
+
+
+
+<% end %> diff --git a/app/views/lotteries/show.html.erb b/app/views/lotteries/show.html.erb index 5a83acb99..ba5455a4c 100644 --- a/app/views/lotteries/show.html.erb +++ b/app/views/lotteries/show.html.erb @@ -130,7 +130,9 @@ <% end %> <% when "results" %> -

Lottery Results<%= " Last updated #{time_ago_in_words(@presenter.lottery.updated_at)} ago" %>

+

+ Lottery Results<%= " Last updated #{time_ago_in_words(@presenter.lottery.updated_at)} ago" %> +


<% if @presenter.viewable_results? %> <% if @presenter.lottery_draws.exists? %> @@ -174,54 +176,7 @@ <% when "stats" %>

Lottery Stats


- <% if @presenter.viewable_results? %> - <% @presenter.stats.each do |division_name, division_stats| %> -
-

<%= "#{division_name}" %>

-
- <%= column_chart @presenter.stats_chart_data(division_stats), - stacked: true, - xtitle: "Number of Tickets", - ytitle: "Entrants", - colors: ["#28a745", "#3A9DD1", "#bbb"] %> - -
- - - - - - - - - - - - - - - - <% division_stats.each do |division_stat| %> - - - - - - - - - - - <% end %> - -
EntrantsAccepted%Waitlisted%Not Drawn%
<%= pluralize(division_stat.number_of_tickets, "Ticket") %><%= division_stat.entrants_count %><%= division_stat.accepted_entrants_count %><%= (division_stat.accepted_entrants_count.to_f / division_stat.entrants_count * 100).round(1) %><%= division_stat.waitlisted_entrants_count %><%= (division_stat.waitlisted_entrants_count.to_f / division_stat.entrants_count * 100).round(1) %><%= division_stat.undrawn_entrants_count %><%= (division_stat.undrawn_entrants_count.to_f / division_stat.entrants_count * 100).round(1) %>
-
-
-
- <% end %> - <% else %> -
This lottery is not yet live
- <% end %> + <%= render partial: "acceptance_stats", locals: { presenter: @presenter } %> <% end %>