1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Cache team scores

This commit is contained in:
2015-12-23 15:00:48 +00:00
parent dd23d1246d
commit b0640a61a7
2 changed files with 23 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
class School < ActiveRecord::Base
belongs_to :tournament
belongs_to :tournament, touch: true
has_many :wrestlers, dependent: :destroy
has_many :deductedPoints, through: :wrestlers

View File

@@ -1,22 +1,24 @@
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" , :class=>"btn btn-default"%>
<br>
<br>
<h3>Team Scores</h3>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<% @schools.each do |school| %>
<% cache ["team_scores", @tournament] do %>
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" , :class=>"btn btn-default"%>
<br>
<br>
<h3>Team Scores</h3>
<table class="table table-striped table-bordered">
<thead>
<tr>
<td><%= school.name %></td>
<td><%= school.pageScore %></td>
<th>Name</th>
<th>Score</th>
</tr>
<% end %>
</tbody>
</table>
</thead>
<tbody>
<% @schools.each do |school| %>
<tr>
<td><%= school.name %></td>
<td><%= school.pageScore %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>