Seperate attacks and defenses

This commit is contained in:
Andrew Tomaka 2015-04-28 12:01:22 -04:00
parent 69bd64abf8
commit f89437b14c
2 changed files with 5 additions and 2 deletions

3
app.rb
View file

@ -51,12 +51,13 @@ get '/bossfight' do
@contributors = []
@contributor_attacks.each do |k, v|
attacks = @contributor_attacks[k] || 0
attacks += @contributor_defenses[k] if @contributor_defenses[k]
defenses = @contributor_defenses[k] || 0
lost = @contributor_soldiers[k] || 0
lost += @contributor_defenders[k] if @contributor_defenders[k]
@contributors << {
username: k,
attacks: attacks,
defenses: defenses,
lost: lost
}
end

View file

@ -24,7 +24,8 @@
<thead>
<tr>
<td>Attacker</td>
<td>Attempts</td>
<td>Attacks</td>
<td>Defenses</td>
<td>Soldiers Killed</td>
</tr>
</thead>
@ -33,6 +34,7 @@
<tr>
<td><%= contributor[:username] %></td>
<td class="text-right"><%= contributor[:attacks] %></td>
<td class="text-right"><%= contributor[:defenses] %></td>
<td class="text-right"><%= readable_number(contributor[:lost]) %></td>
</tr>
<% end %>