Browse Source

Removed limit which was interacting to the stats count

remotes/origin/master
echarp 2 years ago
parent
commit
19826f581a
  1. 3
      app/controllers/events_controller.rb
  2. 2
      app/controllers/stats_controller.rb
  3. 3
      app/models/event.rb

3
app/controllers/events_controller.rb

@ -83,7 +83,8 @@ class EventsController < ApplicationController
private
def set_events
@events = apply_scopes Event.moderated
# The 3000 limit is purely arbitrary...
@events = apply_scopes Event.moderated.limit(3000)
@events = @events.limit(20) if params[:format] == 'rss'
end

2
app/controllers/stats_controller.rb

@ -30,7 +30,7 @@ class StatsController < ApplicationController
def set_events
# Remove the ordering which can occur after geocoding
@events = apply_scopes(Event.moderated).reorder nil
@events = apply_scopes(Event.unscoped.moderated).reorder nil
end
def year_grouping

3
app/models/event.rb

@ -42,8 +42,7 @@ class Event < ApplicationRecord
after_destroy EventCallbacks
# The 3000 limit is purely arbitrary...
default_scope { includes(:base_tags).order('events.id desc').limit(3000) }
default_scope { includes(:base_tags).order('events.id desc') }
scope :moderated, ->(*) { where moderated: true }
scope :unmoderated, ->(*) { where moderated: false }
scope :past, -> { where 'start_time <= ?', Time.zone.now }

Loading…
Cancel
Save