Skip to content

Commit

Permalink
feat: promote lately hosting locations by showing them first
Browse files Browse the repository at this point in the history
  • Loading branch information
salzig committed Jan 14, 2025
1 parent 35571be commit 9a6c6b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/locations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class LocationsController < ApplicationController
expose(:location, find: ->(id, scope) { scope.from_slug(id) })
expose(:locations) { Location.ordered }
expose(:locations) { Location.ordered_by_lastest_event }
expose(:organizers) { User.organizers }
expose(:stats) { Event.stats }

Expand Down
1 change: 1 addition & 0 deletions app/models/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Location < ApplicationRecord
validates :url, length: { maximum: 255 }

scope :ordered, -> { order('name ASC') }
scope :ordered_by_last_occurrence, -> { joins(:events).group(primary_key).order(Event.arel_table[:date].maximum.desc) }
default_scope -> { where(label: Whitelabel[:label_id]) }

def geo_coder_address
Expand Down

0 comments on commit 9a6c6b2

Please # to comment.