From ae056ec7f89e3b2b9b050766508e9a286e7a96d7 Mon Sep 17 00:00:00 2001 From: jcwimer Date: Thu, 17 Dec 2015 13:06:42 +0000 Subject: [PATCH] Added when they last wrestled --- app/models/wrestler.rb | 1 + app/views/mats/_match_edit_form.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/wrestler.rb b/app/models/wrestler.rb index b822d92..7417a78 100644 --- a/app/models/wrestler.rb +++ b/app/models/wrestler.rb @@ -9,6 +9,7 @@ class Wrestler < ActiveRecord::Base before_create do self.tournament.destroyAllMatches end + def lastFinishedMatch allMatches.select{|m| m.finished == 1}.sort_by{|m| m.bout_number}.last diff --git a/app/views/mats/_match_edit_form.html.erb b/app/views/mats/_match_edit_form.html.erb index 65ffaa6..d5dd506 100644 --- a/app/views/mats/_match_edit_form.html.erb +++ b/app/views/mats/_match_edit_form.html.erb @@ -17,11 +17,11 @@ <%= @w1.name %> +
Last Match: <%= if @w1.lastMatch != nil then time_ago_in_words(@w1.lastMatch.updated_at) end%> <%= @w2.name %> +
Last Match: <%= if @w2.lastMatch != nil then time_ago_in_words(@w2.lastMatch.updated_at) end%>