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%>