mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-26 07:56:57 +00:00
Added a stats page for teams
This commit is contained in:
Binary file not shown.
@@ -1,9 +1,13 @@
|
|||||||
class SchoolsController < ApplicationController
|
class SchoolsController < ApplicationController
|
||||||
before_action :set_school, only: [:show, :edit, :update, :destroy]
|
before_action :set_school, only: [:show, :edit, :update, :destroy, :stats]
|
||||||
before_action :check_access_director, only: [:new,:create,:destroy]
|
before_action :check_access_director, only: [:new,:create,:destroy]
|
||||||
before_action :check_access_delegate, only: [:update,:edit]
|
before_action :check_access_delegate, only: [:update,:edit]
|
||||||
|
|
||||||
|
|
||||||
|
def stats
|
||||||
|
@tournament = @school.tournament
|
||||||
|
end
|
||||||
|
|
||||||
# GET /schools/1
|
# GET /schools/1
|
||||||
# GET /schools/1.json
|
# GET /schools/1.json
|
||||||
def show
|
def show
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<% if can? :manage, @school %>
|
<% if can? :manage, @school %>
|
||||||
| <%= link_to "Edit #{@school.name}", edit_school_path(@school),:class=>"btn btn-primary" %>
|
| <%= link_to "Edit #{@school.name}", edit_school_path(@school),:class=>"btn btn-primary" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
| <%= link_to "#{@school.name} Stat Summary", "/schools/#{@school.id}/stats",:class=>"btn btn-primary" %>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
34
app/views/schools/stats.html.erb
Normal file
34
app/views/schools/stats.html.erb
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<%= link_to "Back to #{@school.name}", "/schools/#{@school.id}", :class=>"btn btn-default" %>
|
||||||
|
<% cache ["#{@school.id}_Stats", @school] do %>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<h2><%= @school.name %> Stats Summary</h2>
|
||||||
|
<br>
|
||||||
|
<h4>Matches</h4>
|
||||||
|
<br>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Wrester</th>
|
||||||
|
<th>Bout</th>
|
||||||
|
<th>Match Bracket Position</th>
|
||||||
|
<th>Stats</th>
|
||||||
|
<th>Result</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @school.wrestlers.each do |wrestler| %>
|
||||||
|
<% wrestler.allMatches.each do |m| %>
|
||||||
|
<tr>
|
||||||
|
<td> <%= wrestler.name %>
|
||||||
|
<td><%= m.bout_number %></td>
|
||||||
|
<td><%= m.bracket_position %></td>
|
||||||
|
<td><%= m.list_w1_stats %><br><%= m.list_w2_stats %></td>
|
||||||
|
<td><%= wrestler.resultByBout(m.bout_number) %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
@@ -54,6 +54,7 @@ Wrestling::Application.routes.draw do
|
|||||||
post 'weights/:id/re_gen' => 'weights#re_gen', :as => :regen_weight
|
post 'weights/:id/re_gen' => 'weights#re_gen', :as => :regen_weight
|
||||||
post "/wrestlers/update_pool" => "wrestlers#update_pool"
|
post "/wrestlers/update_pool" => "wrestlers#update_pool"
|
||||||
|
|
||||||
|
get "schools/:id/stats" => "schools#stats"
|
||||||
#API
|
#API
|
||||||
get "/api/tournaments" => "api#tournaments"
|
get "/api/tournaments" => "api#tournaments"
|
||||||
get "/api/tournaments/user" => "api#currentUserTournaments"
|
get "/api/tournaments/user" => "api#currentUserTournaments"
|
||||||
|
|||||||
Reference in New Issue
Block a user