account for unkilled

This commit is contained in:
Andrew Tomaka 2015-04-28 11:59:39 -04:00
parent 3b1325654b
commit 69bd64abf8
2 changed files with 11 additions and 8 deletions

15
app.rb
View file

@ -36,14 +36,17 @@ get '/bossfight' do
user_defenses = Raid.defenses_for_user(@username)
user_attacks = Raid.attacks_for_user(@username)
@first_negative = user_defenses.first_negative
@soldiers_killed = user_defenses.soldiers_lost_to_date(@first_negative.created_at)
first_negative = user_defenses.first_negative
@kill_date = first_negative ? first_negative.created_at : DateTime.now
@kill_user = first_negative ? first_negative.attacker : '<strong>UNKILLED</strong>'
@contributor_attacks = user_defenses.contributor_attacks(@first_negative.created_at)
@contributor_soldiers = user_defenses.contributor_soldiers(@first_negative.created_at)
@soldiers_killed = user_defenses.soldiers_lost_to_date(@kill_date)
@contributor_defenses = user_attacks.contributor_defenses(@first_negative.created_at)
@contributor_defenders = user_attacks.contributor_defenders(@first_negative.created_at)
@contributor_attacks = user_defenses.contributor_attacks(@kill_date)
@contributor_soldiers = user_defenses.contributor_soldiers(@kill_date)
@contributor_defenses = user_attacks.contributor_defenses(@kill_date)
@contributor_defenders = user_attacks.contributor_defenders(@kill_date)
@contributors = []
@contributor_attacks.each do |k, v|

View file

@ -6,11 +6,11 @@
</li>
<li class="list-group-item text-right">
<span class="pull-left"><strong>Kill Date:</strong></span>
<%= @first_negative.created_at.strftime('%H:%M on %m-%d-%Y') if @first_negative %>
<%= @kill_date.strftime('%H:%M on %m-%d-%Y') if @kill_date %>
</li>
<li class="list-group-item text-right">
<span class="pull-left"><strong>Killing Blow:</strong></span>
<%= @first_negative.attacker if @first_negative %>
<%= @kill_user if @kill_user %>
</li>
<li class="list-group-item text-right">
<span class="pull-left"><strong>Soliders Killed:</strong></span>