app/policies/pairing/rounds_generator.rb
# frozen_string_literal: trueAdd an empty line after magic comments.module Pairing class RoundsGenerator def initialize(round_number) @round_number = round_number end def generate! ActiveRecord::Base.transaction do bye.try(:save!) rounds.each(&:save!) end end Assignment Branch Condition size for rounds is too high. [17.58/15] def rounds @rounds ||= pairings.each do |round| round.round_number = round_number round.room = rooms.pop judges.each do |judge| next if JudgePolicy.new(judge, round.gov_team).conflicted? ||Align the operands of a condition in an `if` statement spanning multiple lines. JudgePolicy.new(judge, round.opp_team).conflicted? round.judges << judges.pop break end end end private attr_reader :round_number def teams_for_pairing @teams_for_pairing ||= teams - [bye.try(:team)] end def bye @bye ||= ByeGenerator.new(teams).generate! end def teams @teams ||= Team.checked_in(round_number).to_a.sort end def rooms @rooms ||= Room.checked_in(round_number).order(:rank).to_a end def judges @judges ||= Judge.checked_in(round_number).order(:rank).to_a end def pairings @pairings ||= PairingGenerator.new(teams_for_pairing).generate!.sort end endend