mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-13 21:31:28 +00:00
Fix bug on user page slow way
This commit is contained in:
parent
e59e8ac8e7
commit
9a6db89139
2 changed files with 2 additions and 2 deletions
|
@ -90,7 +90,7 @@ class Match < ActiveRecord::Base
|
|||
scope :of_contester, -> (contester) { where("contester1_id = ? OR contester2_id = ?", contester.id, contester.id) }
|
||||
scope :of_user, -> (user) { includes(:matchers).where("matchers.user_id = ?", user.id) }
|
||||
scope :of_team, -> (team) { includes({:contester1 => :team, :contester2 => :team}).where("teams.id = ? OR teams_contesters.id = ?", team.id, team.id) }
|
||||
scope :of_userteam, -> (user, team) { includes({:matchers => {:contester => :team}}).where("teams.id = ? AND matchers.user_id = ?", team.id, user.id) }
|
||||
scope :of_userteam, -> (user, team) { eager_load({:matchers => {:contester => :team}}).where("teams.id = ? AND matchers.user_id = ?", team.id, user.id) }
|
||||
scope :within_time, -> (from, to) { where("match_time > ? AND match_time < ?", from.utc, to.utc) }
|
||||
scope :around, -> (time) { where("match_time > ? AND match_time < ?", time.ago(MATCH_LENGTH).utc, time.ago(-MATCH_LENGTH).utc) }
|
||||
scope :after, -> (time) { where("match_time > ? AND match_time < ?", time.utc, time.ago(-MATCH_LENGTH).utc) }
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<th class="maps">Maps</th>
|
||||
<% end %>
|
||||
<th class="score">Score</th>
|
||||
<% if matches.first and matches.first.contest.contest_type == Contest::TYPE_LADDER %>
|
||||
<% if matches&.first.contest.contest_type == Contest::TYPE_LADDER %>
|
||||
<th class="points">Points</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue