From 462d47de614ddd87af2870990414cc69a5788f17 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 28 Apr 2015 11:02:17 -0400 Subject: [PATCH] Make prettier --- app.rb | 2 -- models/raid.rb | 4 ++-- views/bossfight.erb | 22 +++++++++++++++++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app.rb b/app.rb index 7220fa5..bb91e4b 100644 --- a/app.rb +++ b/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 diff --git a/models/raid.rb b/models/raid.rb index d5593f7..276e23d 100644 --- a/models/raid.rb +++ b/models/raid.rb @@ -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 diff --git a/views/bossfight.erb b/views/bossfight.erb index 235f679..015c051 100644 --- a/views/bossfight.erb +++ b/views/bossfight.erb @@ -19,7 +19,23 @@ -
-<% require 'pp' %> -<% pp @contributers %> +
+ + + + + + + + + + <% @contributers.each do |contributer| %> + + + + + + <% end %> + +
AttackerAttemptsSoldiers Killed
<%= contributer[0]%><%= readable_number(contributer[1]) %>