Improved most_frequent_action method; Introduced LogFile check for improper composition where games have more than two teams.

This commit is contained in:
Cutieguwu
2025-04-26 14:45:25 -04:00
parent fd5d7951f9
commit 352df77645
3 changed files with 55 additions and 55 deletions

View File

@@ -11,7 +11,7 @@ pub struct Game {
impl Game {
/// Returns the teams that played.
pub fn teams(&self) -> Result<Vec<Team>, error::TeamsError> {
pub fn teams(&self) -> Result<Vec<Team>, error::LogFileError> {
let ignore: Vec<Team> = self
.flags
.iter()
@@ -37,7 +37,7 @@ impl Game {
if teams.len() == 2 || ignore.len() != 0 {
Ok(teams)
} else {
Err(error::TeamsError::NumberFound(teams.len()))
Err(error::LogFileError::TooManyTeams(teams.len()))
}
}