Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/load-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ on:
# # Run smoke test nightly at 2am UTC
# - cron: '0 2 * * *'

permissions:
contents: read
pull-requests: write
issues: write

env:
K6_VERSION: '0.47.0'

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/nightly-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
# - cron: '0 1 * * *'
workflow_dispatch:

permissions:
contents: read
issues: write

jobs:
full-security-audit:
name: Complete Security Audit
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
# # Run weekly on Monday at 9am UTC
# - cron: '0 9 * * 1'

permissions:
contents: read
pull-requests: write
issues: write

jobs:
brakeman:
name: Brakeman Security Scan
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/api/v1/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ def active_goals_data
def roster_status_data
players = organization_scoped(Player).includes(:champion_pools)

# Order by role to ensure consistent order in by_role hash
by_role_ordered = players.ordered_by_role.group(:role).count

{
by_role: players.group(:role).count,
by_role: by_role_ordered,
by_status: players.group(:status).count,
contracts_expiring: players.contracts_expiring_soon.count
}
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/v1/players_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def index
players = players.where('summoner_name ILIKE ? OR real_name ILIKE ?', search_term, search_term)
end

# Pagination
result = paginate(players.order(:role, :summoner_name))
# Pagination - order by role (top, jungle, mid, adc, support) then by name
result = paginate(players.ordered_by_role.order(:summoner_name))

render_success({
players: PlayerSerializer.render_as_hash(result[:data]),
Expand Down
12 changes: 12 additions & 0 deletions app/models/player.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ class Player < ApplicationRecord
where(contract_end_date: Date.current..Date.current + days.days)
}
scope :by_tier, ->(tier) { where(solo_queue_tier: tier) }
scope :ordered_by_role, -> {
order(Arel.sql(
"CASE role
WHEN 'top' THEN 1
WHEN 'jungle' THEN 2
WHEN 'mid' THEN 3
WHEN 'adc' THEN 4
WHEN 'support' THEN 5
ELSE 6
END"
))
}

# Instance methods
def current_rank_display
Expand Down