ozfortress/citadel

View on GitHub
app/views/leagues/matches/_match_scores.html.haml

Summary

Maintainability
Test Coverage
- if match.pending? || user_can_edit_league?
  = render 'leagues/matches/match_pick_bans_form', match: match, pick_bans: pick_bans

  .card-body
    - if match.picking_completed? || user_can_edit_league?
      = render 'leagues/matches/match_scores_form', match: match

- if !match.pending? && !match.confirmed? && !user_can_edit_league?
  %table.table.mb-0
    - present_collection(match.rounds).each do |round_p|
      %tr
        %td= round_p.map.link
        %td= round_p.result

  - if user_can_confirm_score?
    .card-body.d-flex.justify-content-end
      = button_to confirm_match_path(match, confirm: false),
                  class: 'btn btn-danger mr-2', method: :patch do
        Challenge Score

      = button_to confirm_match_path(match, confirm: true),
                  class: 'btn btn-success', method: :patch do
        Confirm Score