• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yurak / fanta / #638766805

06 Apr 2026 09:37PM UTC coverage: 98.508%. First build
#638766805

Pull #508

travis-ci

Pull Request #508: Add join flow

344 of 345 new or added lines in 36 files covered. (99.71%)

5349 of 5430 relevant lines covered (98.51%)

204.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.67
/app/controllers/api/players_controller.rb
1
module Api
1✔
2
  class PlayersController < Api::ApplicationController
1✔
3
    skip_before_action :authenticate_user!, only: %i[index show stats]
1✔
4

5
    respond_to :json
1✔
6

7
    helper_method :player
1✔
8

9
    def index
1✔
10
      result = Players::Query.call(query_params)
3✔
11
      players = if page.present?
3✔
NEW
12
                  Kaminari.paginate_array(result).page(page[:number]).per(page[:size])
×
13
                else
14
                  Kaminari.paginate_array(result).page(1).per([result.size, 1].max)
3✔
15
                end
16
      ActiveRecord::Associations::Preloader.new.preload(players.to_a, [:transfers, { club: :tournament }, { player_positions: :position }])
3✔
17
      players_ser = players.map { |l| PlayerBaseSerializer.new(l, league_id: filter_params[:league_id]) }
8✔
18
      render json: { data: players_ser, meta: response_options(players) }
3✔
19
    end
20

21
    def show
1✔
22
      if player
2✔
23
        render json: { data: PlayerSerializer.new(player) }
1✔
24
      else
25
        not_found
1✔
26
      end
27
    end
28

29
    def stats
1✔
30
      if player
2✔
31
        render json: { data: PlayerStatsSerializer.new(player) }
1✔
32
      else
33
        not_found
1✔
34
      end
35
    end
36

37
    private
1✔
38

39
    def player
1✔
40
      @player ||= Player.find_by(id: params[:id])
6✔
41
    end
42

43
    def query_params
1✔
44
      filter_params.merge(order_params)
3✔
45
    end
46

47
    def filter_params
1✔
48
      params.fetch(:filter, {})
8✔
49
            .permit(:league_id, :name, :without_team,
50
                    app: {}, base_score: {}, total_score: {},
51
                    club_id: [], position: [], team_id: [], tournament_id: [])
52
    end
53

54
    def order_params
1✔
55
      params.fetch(:order, {}).permit(:direction, :field)
3✔
56
    end
57
  end
58
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc