1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-31 11:35:45 +00:00

Updating views

This commit is contained in:
2015-11-18 13:11:47 +00:00
parent 67727c6391
commit 0ba25da89a
5 changed files with 18 additions and 6 deletions

View File

@@ -60,7 +60,7 @@ class TournamentsController < ApplicationController
def team_scores
@schools = @tournament.schools
@schools.sort_by{|s| s.score}.reverse!
@schools = @schools.sort_by{|s| s.pageScore}.reverse!
end

View File

@@ -5,9 +5,18 @@ class School < ActiveRecord::Base
#calculate score here
def pageScore
if self.score == nil
return 0.0
else
return self.score
end
end
def calcScore
totalWrestlerPoints - totalDeductedPoints
newScore = totalWrestlerPoints - totalDeductedPoints
self.score = newScore
self.save
end
def totalWrestlerPoints

View File

@@ -17,14 +17,17 @@
<%= f.label "Win Type" %><br>
<%= f.select(:win_type, Match::WIN_TYPES) %>
</div>
<br>
<div class="field">
<%= f.label "Winner" %> Please put in the id of the winner<br>
<%= f.label "Winner" %> Please choose the winner<br>
<%= f.collection_select :winner_id, @wrestlers, :id, :name %>
</div>
<br>
<div class="field">
<%= f.label "Score" %> Also put pin time here if applicable. If default or forfeit, leave blank<br>
<%= f.label "Score" %> Also put pin time here if applicable. If default or forfeit, leave blank. Example: 7-2, 17-2, or 2:34<br>
<%= f.text_field :score %>
</div>
<br>
<%= f.hidden_field :finished, :value => 1 %>
<%= f.hidden_field :round, :value => @match.round %>

View File

@@ -15,7 +15,7 @@
<% @schools.each do |school| %>
<tr>
<td><%= school.name %></td>
<td><%= school.score %></td>
<td><%= school.pageScore %></td>
</tr>
<% end %>
</tbody>

View File

@@ -29,7 +29,7 @@
<br>
<% @wrestler.allMatches.each do |m| %>
<div> Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= m.bracketScore %></div>
<div> Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= @wrestler.resultByBout(m.bout_number) %></div>
<% end %>
<% @wrestler.deductedPoints.each do |w| %>
<div> Deducted points: <%= w.points %></div>