Skip to content

Commit

Permalink
Passing pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNaessens committed May 19, 2024
1 parent 6cdc338 commit 796d0e0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class EventsController < ApplicationController
respond_to :html, :js, :ics

def index
@events = Event.where('end_date > ?', DateTime.now).order(:start_date)
@events = Event.where('end_date > ?', DateTime.now).order(start_date: :asc)
@past_events = if user_signed_in?
Event.accessible_by(current_ability).order(:name)
Event.accessible_by(current_ability).order(start_date: :desc)
else
[]
end
Expand Down Expand Up @@ -84,7 +84,7 @@ def statistics
@data = @event.access_levels.map do |al|
{
name: al.name,
data: zeros.merge(al.registrations.group('registrations.name, date(registrations.created_at)').count.transform_keys { |key| key.strftime("%Y-%m-%d") })
data: zeros.merge(al.registrations.group('date(registrations.created_at)').count.transform_keys { |key| key.strftime("%Y-%m-%d") })
}
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def index

authorize! :read, @event

@registrationsgrid = RegistrationsGrid.new(params[:registrations_grid]) do |scope|
@registrationsgrid = RegistrationsGrid.new(order: :name, **params.fetch(:registrations_grid, {}).permit!) do |scope|
scope.where(event_id: @event.id).order(Arel.sql("registrations.price - paid DESC"))
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def user_rules(user)
if clubs.present?
can :create, Event
can :show, Event
can :crud, Event, ["? IN (?)", :club_id, clubs.pluck(:id)] do |e|
can :crud, Event, ["club_id IN (?)", clubs.ids] do |e|
clubs.include? e.club
end
else
Expand Down
2 changes: 0 additions & 2 deletions app/models/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class Registration < ApplicationRecord
end
end

default_scope { order "name ASC" }

def paid
from_cents read_attribute(:paid)
end
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ services:
- "6379:6379"

volumes:
db_data:
gandalf_data:
gandalf_test_data:
redis_data:

0 comments on commit 796d0e0

Please sign in to comment.