mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Revert "Added memcached and set up cached items for up_matches page"
This reverts commit 983cc9c667.
This commit is contained in:
@@ -18,15 +18,6 @@ class Mat < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def cached_matches
|
||||
cache_timestamp = self.updated_at
|
||||
cache_key = "matMatches|#{id}|#{cache_timestamp}"
|
||||
|
||||
Rails.cache.fetch(cache_key, expires_in: 10.minutes) do
|
||||
self.matches.includes(:wrestlers)
|
||||
end
|
||||
end
|
||||
|
||||
def assignNextMatch
|
||||
t_matches = tournament.matches.select{|m| m.mat_id == nil}
|
||||
if t_matches.size > 0
|
||||
@@ -37,7 +28,7 @@ class Mat < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def unfinishedMatches
|
||||
cached_matches.select{|m| m.finished == nil}.sort_by{|m| m.bout_number}
|
||||
matches.select{|m| m.finished == nil}.sort_by{|m| m.bout_number}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Match < ActiveRecord::Base
|
||||
belongs_to :tournament, touch: true
|
||||
belongs_to :weight, touch: true
|
||||
belongs_to :mat, touch: true
|
||||
belongs_to :tournament
|
||||
belongs_to :weight
|
||||
belongs_to :mat
|
||||
has_many :wrestlers, :through => :weight
|
||||
|
||||
after_save do
|
||||
|
||||
@@ -9,14 +9,7 @@ class Tournament < ActiveRecord::Base
|
||||
has_many :wrestlers, through: :weights
|
||||
has_many :matches, dependent: :destroy
|
||||
|
||||
def cached_matches
|
||||
cache_timestamp = self.updated_at
|
||||
cache_key = "tournamentMatches|#{id}|#{cache_timestamp}"
|
||||
|
||||
Rails.cache.fetch(cache_key, expires_in: 10.minutes) do
|
||||
self.matches.includes(:wrestlers)
|
||||
end
|
||||
end
|
||||
|
||||
def tournament_types
|
||||
["Pool to bracket"]
|
||||
|
||||
Reference in New Issue
Block a user