FootyStats / footy

Football Statistics
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Agree behaviour for add_team and add_fixture methods on Competition #25

Open SebDuff opened 3 years ago

SebDuff commented 3 years ago

We need to agree how we want the add_team(Team) and add_fixture(Fixture) (not yet created) methods to behave.

For add_team(Team), I was thinking we should check if there is already a team with that name. If one is already in the list, throw an exception, else add. This will prevent duplicate teams being added and force us to retrieve the team and update it directly. Alternatively, we could have an optional override parameter which forces it to replace the team with the same name (if it exists).

For add_fixture(Fixture), it's a practical case that the same two teams will play each other in the same competition, so I think we should just add the fixture if the same Fixture object doesn't already exist in the list (as per current functionality of add_team(Team))