diff --git a/app/models/match.rb b/app/models/match.rb index 70ce5f8..4bf1158 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -6,6 +6,8 @@ class Match < ActiveRecord::Base after_save do if self.finished == 1 && self.winner_id != nil + wrestler1.touch + wrestler2.touch advance_wrestlers calcSchoolPoints end diff --git a/app/models/wrestler.rb b/app/models/wrestler.rb index d957a18..dd78e58 100644 --- a/app/models/wrestler.rb +++ b/app/models/wrestler.rb @@ -1,6 +1,6 @@ class Wrestler < ActiveRecord::Base - belongs_to :school - belongs_to :weight + belongs_to :school, touch: true + belongs_to :weight, touch: true has_one :tournament, through: :weight has_many :matches, through: :weight has_many :deductedPoints, class_name: "Teampointadjust" diff --git a/app/views/schools/show.html.erb b/app/views/schools/show.html.erb index 8e75732..ccb09a8 100644 --- a/app/views/schools/show.html.erb +++ b/app/views/schools/show.html.erb @@ -1,76 +1,78 @@ -
<%= notice %>
-<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}",:class=>"btn btn-default" %> -<% if tournament_permissions(@school.tournament) %> -| <%= link_to "Edit #{@school.name}", edit_school_path(@school),:class=>"btn btn-primary" %> -<% end %> -- Name: - <%= @school.name %> -
- -- Score: - <%= @school.score %> -
- -- Tournament: - <%= Tournament.find(@school.tournament_id).name %> -
- - - - - -| Name | -Weight | -Seed | -Record | -Seed Criteria | -Team Points Scored | -Extra? | -Next Bout/Mat | -Actions | -
|---|---|---|---|---|---|---|---|---|
| <%= wrestler.name %> | -<%= Weight.find(wrestler.weight_id).max %> | -- <%= wrestler.original_seed %> - | -<%= wrestler.season_win %>-<%= wrestler.season_loss %> | -<%= wrestler.criteria %> Win <%= wrestler.seasonWinPercentage %>% | -<%= wrestler.totalTeamPoints - wrestler.totalDeductedPoints %> | -<% if wrestler.extra? == true %> - Yes - <% end %> | -<%= wrestler.nextMatchBoutNumber %> <%= wrestler.nextMatchMatName %> | -- <%= link_to 'Show', wrestler , :class=>"btn btn-default" %> - <% if tournament_permissions(@school.tournament) %> - <%= link_to 'Edit', edit_wrestler_path(wrestler),:class=>"btn btn-primary" %> - <%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %> - <% end %> - | -
| Name | +Weight | +Seed | +Record | +Seed Criteria | +Team Points Scored | +Extra? | +Next Bout/Mat | +Actions | +
|---|---|---|---|---|---|---|---|---|
| <%= wrestler.name %> | +<%= Weight.find(wrestler.weight_id).max %> | ++ <%= wrestler.original_seed %> + | +<%= wrestler.season_win %>-<%= wrestler.season_loss %> | +<%= wrestler.criteria %> Win <%= wrestler.seasonWinPercentage %>% | +<%= wrestler.totalTeamPoints - wrestler.totalDeductedPoints %> | +<% if wrestler.extra? == true %> + Yes + <% end %> | +<%= wrestler.nextMatchBoutNumber %> <%= wrestler.nextMatchMatName %> | ++ <%= link_to 'Show', wrestler , :class=>"btn btn-default" %> + <% if tournament_permissions(@school.tournament) %> + <%= link_to 'Edit', edit_wrestler_path(wrestler),:class=>"btn btn-primary" %> + <%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %> + <% end %> + | +
<%= notice %>
- -<%= link_to "Back to #{@school.name}", "/schools/#{@school.id}", :class=>"btn btn-default" %> -<% if tournament_permissions(@wrestler.tournament) %> - | <%= link_to "Edit #{@wrestler.name}", edit_wrestler_path(@wrestler), :class=>"btn btn-primary" %> -<% end %> -- Name: - <%= @wrestler.name %> -
- -- School: - <%= @wrestler.school.name %> -
- -- Weight: - <%= @wrestler.weight.max %> -
- -- Team Points Scored: - <%= @wrestler.totalTeamPoints %> -
- -<%= notice %>
+ + <%= link_to "Back to #{@school.name}", "/schools/#{@school.id}", :class=>"btn btn-default" %> + <% if tournament_permissions(@wrestler.tournament) %> + | <%= link_to "Edit #{@wrestler.name}", edit_wrestler_path(@wrestler), :class=>"btn btn-primary" %> + <% end %> ++ Name: + <%= @wrestler.name %> +
+ ++ School: + <%= @wrestler.school.name %> +
+ ++ Weight: + <%= @wrestler.weight.max %> +
+ ++ Team Points Scored: + <%= @wrestler.totalTeamPoints %> +
+ +