porkchopclub/porkchop

View on GitHub
app/views/seasons/_standings.haml

Summary

Maintainability
Test Coverage
%table.season-standings.alternating-rows
  %thead
    %tr
      %th
      %th Player
      %th GP
      %th W
      %th L
      %th W%
      %th GB
      %th(title="Points For") PF
      %th(title="Points Against") PA
      %th(title="Point Differential") PD
  %tbody
    - season.stats.players.each_with_index do |stats, i|
      %tr.season-standings-player
        %td(data-th-label="Rank")= i + 1
        %td(data-th-label="Name")= stats.player.name
        %td(data-th-label="Games Played")= stats.matches_played
        %td(data-th-label="Wins")= stats.matches_won
        %td(data-th-label="Losses")= stats.matches_lost
        %td(data-th-label="Win Ratio")= stats.win_ratio
        %td(data-th-label="Games Back")= stats.games_back || '-'
        %td(data-th-label="Points For")= stats.points_for
        %td(data-th-label="Points Against")= stats.points_against
        %td(data-th-label="Point Differential")
          - unless stats.point_differential == 0
            %span(class="point-differential-#{stats.point_differential < 0 ? 'negative' : 'positive'}")= stats.point_differential