Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation question: advice on how to handle a bye #20

Open
emersonthis opened this issue Nov 11, 2024 · 1 comment
Open

Documentation question: advice on how to handle a bye #20

emersonthis opened this issue Nov 11, 2024 · 1 comment

Comments

@emersonthis
Copy link
Contributor

Example situation where a bye happens:

  it 'creates a bye...' do

    season = create(:season)
    driver = described_class.new season
    Team.create!(name: 'Team 1', season:)
    Team.create!(name: 'Team 2', season:)
    Team.create!(name: 'Team 3', season:)

    TournamentSystem::RoundRobin.generate driver

    expect(season.matches.count).to eq(1)
  end

When I run this test, the test fails because the lib tries to create a second match record in which there is only a home_team but no away_team.

  1. Is this the expected behavior?
  2. Is it a best practice to create placeholder matches in this situation? I currently have a validation rule that requires matches to have two sides. I'm deciding whether it's better to remove it
@BenjaminSchaaf
Copy link
Contributor

Yes, BYEs are generated on purpose and need to be kept track of. SWISS will for instance avoid giving the same team a BYE, but to do that it needs to know which team has had one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants