Add support for byes in matches

#What is this about?

We need to include support for missing fencers, or byes, in matches. A bout can have two, one, or zero fencers and still be valid.

#How to fix it?

This might be best handled by showing a BYE fencer and not recording them in the bout controller. That does introduce some other difficulties or issues. I think this is the simplest solution.

Another way to do it would be to assign each squad a "BYE fencer" (or even re-use the same one across squads) and then not include them in Elo calculations, not show them in seedings or database dumps, etc. This seems not as good since it introduces more edge cases/branches.

Either way, we will need a validation that fencer names do not match the keyword we end up using to denote the "bye" fencer.

#When should this be fixed?

Before the fencing season starts. Ideally this week.

Assigned to
1 year, 6 months ago
10 months ago
priority:high type:feature_request

~ethanmad 1 year, 1 month ago*

The first way listed seems to introduce a loss of information: the present fencer in a bout against a missing fencer will not get recorded. So I will try this using BYE fencers on each squad.

To do this, we can add the BYE fencer during the Create method of the Squad service. This fencer should only be rendered on the Match edit page. The fencer should be excluded from calculations. So we will modify the query method to return all fencers in a squad except for the BYE fencer (distinguishing by name or another field) and add a new query method to include all fencers and the BYE fencer. The edit page will use the new query method.

If the BYE fencer is distinguished by name, then we must add a validation to ensure other fencers cannot be named similarly. If the BYE fencer is distinguished by a new field, the above validation is still useful, but things will likely be more robust. I propose adding a boolean field named "real" or "human" or "bye" to the Fencer struct.

We also need to determine how to score a bout with a missing fencer. Ideally, the score will be 0-0 and the validator will accept that.

Similarly, matches can result in ties now so we need to be able to handle that. A winner can still often be determined by indicator or total touches scored, but not always.

~ethanmad (edited) 1 year, 1 month ago*

Tasks to complete:

  • [X] Add Bye boolfield to Fencer with default value = false
  • [X] Add BYE Fencer in SquadService.Create
  • [X] Add fencerValFns to ensure no manually created fencers have Bye = true or names similar to "bye"
  • [X] Update FencerService.All, FencerService.ByCategory to exclude fencers for whom Bye=true
  • [X] Update SquadService.FencersByID to exclude fencers for whom Bye = true
  • [X] Check that no functions returning []Fencer include fencers for whom Bye=true (checked by git grep "(\[\]Fencer")
  • [X] Write a new method on SquadService which returns Fencers for whom Bye = true
  • [X] Use the new method in the Match Controller Edit method instead of FencersByID
  • [X] Exclude bouts with only one bye fencer from seeding calculations (change fencerService.BoutsByID{,s})
  • [X] Modify bout scoring methods to allow equal score when at least one fencer has Bye = true
  • [X] Modify callers of bout scoring methods to provide necessary information to scoring methods
  • [X] Ensure matches can end in ties
  • [X] Prevent access to update route for bye fencer (will error due to notBye validator function)
  • [X] Include ties in Squad Show view record
  • [X] Factor ties into squads elo calculations (done previously)
  • [X ] Include bye bouts in Fencer controller/view (perhaps as a "Total Bouts" field which includes byes, or just by showing byes alongside real bouts)
  • [ ] Italicize bye fencer's name in Match Edit view - determined to not have good cross-platform support; abandoned
  • [ ] Add/fix BYE Fencer if needed to existing squads (not sure where) - determined to be unnecessary; abandoned

~zezip REPORTED IMPLEMENTED 10 months ago

Closing this ticket- all changes for BYE support have been implemented or abandoned.

Register here or Log in to comment, or comment via email.