Skip to content

Commit

Permalink
remove all cacheing, faster without it, fix draws
Browse files Browse the repository at this point in the history
  • Loading branch information
estiens committed Nov 23, 2022
1 parent 579b0f8 commit 604eae3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ def create_from_json
end

def goal_text
['GOAL!', 'Goooooooollllllll!', 'Goooooooooooooooooooooal!', 'γκολ!'].sample
['GOAL!', 'Goooooooollllllll!', 'Goooooooooooooooooooooal!'].sample
end

def booking_text
['Yellow card!', "That's a card for you, sir!", "The ref's into his pocket", '*whistle* Booked!'].sample
end

def substitution_text
"Substitution #{team.country} #{player} on for #{extra_info['player_off']}"
"Substitution #{team.country} #{player} on for #{extra_info[:player_off]} at #{time}"
end

def slack_message_text
Expand Down
2 changes: 1 addition & 1 deletion app/models/json_stat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(match:)
@modifier = 0
@json_stats = match_stats_for_home_team
@home_stats = @json_stats.present? ? @json_stats[@match.home_team.fifa_code] : nil
@away_stats = @json_stats.present? ? @json_stats[@match.home_team.fifa_code] : nil
@away_stats = @json_stats.present? ? @json_stats[@match.away_team.fifa_code] : nil
write_the_stats
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def away_losses_count
end

def team_draws_count
matches.where('status = ? AND home_team_score = away_team_score AND home_team_penalties IS NULL', 'completed').count
matches.where('status = ? AND home_team_score = away_team_score AND home_team_penalties < 1', 'completed').count
end

def team_wins_count
Expand Down
2 changes: 1 addition & 1 deletion app/views/matches/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1 @@
json.partial! 'matches/match', match: @match, cached: true
json.partial! 'matches/match', match: @match
2 changes: 1 addition & 1 deletion app/views/teams/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
json.groups @groups do |group|
json.letter group.letter
json.teams group.teams, partial: 'teams/result', as: :team, cached: true
json.teams group.teams, partial: 'teams/result', as: :team
end

0 comments on commit 604eae3

Please sign in to comment.