Skip to content

Commit 9876553

Browse files
committed
Fixup: anonymous class can't be serialized
This causes a production internal server error because of caching
1 parent 945be63 commit 9876553

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/controllers/reports_controller.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ class ReportsController < ApplicationController
55
ACTIVE_THREADS_LIMIT = 10
66
NEWCOMERS_LIMIT = 5
77

8+
LiveStats = Struct.new(:messages_total, :participants_active, :topics_new, :participants_new)
9+
810
def index
911
if params[:year].present?
1012
year = params[:year].to_i
@@ -136,8 +138,7 @@ def compute_live_stats
136138
participants_new = first_messages.count { |_, first_at| @period_range.cover?(first_at) }
137139
end
138140

139-
Struct.new(:messages_total, :participants_active, :topics_new, :participants_new)
140-
.new(messages_total, participants_active, topics_new, participants_new)
141+
LiveStats.new(messages_total, participants_active, topics_new, participants_new)
141142
end
142143

143144
def load_rankings

0 commit comments

Comments
 (0)