diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 7e817fb..6aa1d0c 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -30,30 +30,22 @@ class MatchesController < ApplicationController if @match.w1 @wrestler1_name = @match.wrestler1.name @wrestler1_school_name = @match.wrestler1.school.name - if @match.wrestler1.last_match - @wrestler1_last_match = time_ago_in_words(@match.wrestler1.last_match.updated_at) - else - @wrestler1_last_match = "N/A" - end + @wrestler1_last_match = @match.wrestler1.last_match @wrestlers.push(@match.wrestler1) else @wrestler1_name = "Not assigned" @wrestler1_school_name = "N/A" - @wrestler1_last_match = "N/A" + @wrestler1_last_match = nil end if @match.w2 @wrestler2_name = @match.wrestler2.name @wrestler2_school_name = @match.wrestler2.school.name - if @match.wrestler2.last_match - @wrestler2_last_match = time_ago_in_words(@match.wrestler2.last_match.updated_at) - else - @wrestler1_last_match = "N/A" - end + @wrestler2_last_match = @match.wrestler2.last_match @wrestlers.push(@match.wrestler2) else @wrestler2_name = "Not assigned" @wrestler2_school_name = "N/A" - @wrestler2_last_match = "N/A" + @wrestler2_last_match = nil end @tournament = @match.tournament end diff --git a/app/views/matches/_matchstats.html.erb b/app/views/matches/_matchstats.html.erb index 56ec254..0c7bd1a 100644 --- a/app/views/matches/_matchstats.html.erb +++ b/app/views/matches/_matchstats.html.erb @@ -20,13 +20,13 @@
School: <%= @wrestler1_school_name %> -
Last Match: <%= @wrestler1_last_match %> +
Last Match: <%= @wrestler1_last_match ? time_ago_in_words(@wrestler1_last_match.updated_at) : "N/A" %> Name: <%= @wrestler2_name %>
School: <%= @wrestler2_school_name %> -
Last Match: <%= @wrestler2_last_match %> +
Last Match: <%= @wrestler2_last_match ? time_ago_in_words(@wrestler2_last_match.updated_at) : "N/A" %> @@ -41,15 +41,15 @@ - - + + <%= @wrestler2_name %> Scoring
- +