Make prettier
This commit is contained in:
parent
8d85ef6256
commit
462d47de61
3 changed files with 21 additions and 7 deletions
2
app.rb
2
app.rb
|
@ -37,8 +37,6 @@ get '/bossfight' do
|
|||
@first_negative = user_raids.first_negative
|
||||
@soldiers_killed = user_raids.soldiers_lost_to_date(@first_negative.created_at)
|
||||
@contributers = user_raids.contributors(@first_negative.created_at)
|
||||
require 'pp'
|
||||
pp @contributers
|
||||
|
||||
erb :bossfight
|
||||
end
|
||||
|
|
|
@ -18,10 +18,10 @@ class Raid < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.soldiers_lost_to_date(date)
|
||||
where('created_at < ?', date).sum(:soldiers)
|
||||
where('created_at <= ?', date).sum(:soldiers)
|
||||
end
|
||||
|
||||
def self.contributors(date)
|
||||
where('created_at < ?', date).group(:attacker).sum(:soldiers)
|
||||
where('created_at <= ?', date).group(:attacker).sum(:soldiers)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,23 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<% require 'pp' %>
|
||||
<% pp @contributers %>
|
||||
<div class="col-md-9">
|
||||
<table class="table table-striped table-hover table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Attacker</td>
|
||||
<td>Attempts</td>
|
||||
<td>Soldiers Killed</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @contributers.each do |contributer| %>
|
||||
<tr>
|
||||
<td><%= contributer[0]%></td>
|
||||
<td></td>
|
||||
<td><%= readable_number(contributer[1]) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue