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
|
@first_negative = user_raids.first_negative
|
||||||
@soldiers_killed = user_raids.soldiers_lost_to_date(@first_negative.created_at)
|
@soldiers_killed = user_raids.soldiers_lost_to_date(@first_negative.created_at)
|
||||||
@contributers = user_raids.contributors(@first_negative.created_at)
|
@contributers = user_raids.contributors(@first_negative.created_at)
|
||||||
require 'pp'
|
|
||||||
pp @contributers
|
|
||||||
|
|
||||||
erb :bossfight
|
erb :bossfight
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,10 +18,10 @@ class Raid < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.soldiers_lost_to_date(date)
|
def self.soldiers_lost_to_date(date)
|
||||||
where('created_at < ?', date).sum(:soldiers)
|
where('created_at <= ?', date).sum(:soldiers)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.contributors(date)
|
def self.contributors(date)
|
||||||
where('created_at < ?', date).group(:attacker).sum(:soldiers)
|
where('created_at <= ?', date).group(:attacker).sum(:soldiers)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,23 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-9">
|
||||||
<% require 'pp' %>
|
<table class="table table-striped table-hover table-bordered table-condensed">
|
||||||
<% pp @contributers %>
|
<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>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue