added left status

This commit is contained in:
Franklin 2022-10-13 08:43:33 -04:00
parent 8aa1dd61d6
commit baa0252cad
2 changed files with 5 additions and 2 deletions

View File

@ -9,7 +9,8 @@ pub enum LeaguePlayerStatus {
Joined, Joined,
#[default] #[default]
Requested, Requested,
Kicked Kicked,
Left
} }
impl Display for LeaguePlayerStatus { impl Display for LeaguePlayerStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@ -18,6 +19,7 @@ impl Display for LeaguePlayerStatus {
LeaguePlayerStatus::Joined => write!(f, "Joined"), LeaguePlayerStatus::Joined => write!(f, "Joined"),
LeaguePlayerStatus::Requested => write!(f, "Requested"), LeaguePlayerStatus::Requested => write!(f, "Requested"),
LeaguePlayerStatus::Kicked => write!(f, "Kicked"), LeaguePlayerStatus::Kicked => write!(f, "Kicked"),
LeaguePlayerStatus::Left => write!(f, "Left")
} }
} }
} }
@ -30,6 +32,7 @@ impl FromStr for LeaguePlayerStatus {
"Joined" => Ok(Self::Joined), "Joined" => Ok(Self::Joined),
"Requested" => Ok(Self::Requested), "Requested" => Ok(Self::Requested),
"Kicked" => Ok(Self::Kicked), "Kicked" => Ok(Self::Kicked),
"Left" => Ok(Self::Requested),
_ => Err(Error::Unspecified) //TODO: Create ParseStr error in actix_web_utils _ => Err(Error::Unspecified) //TODO: Create ParseStr error in actix_web_utils
} }
} }

View File

@ -21,7 +21,7 @@ pub struct League {
pub state: String, pub state: String,
pub visibility: String, pub visibility: String,
/// When is the league happening? /// When is the league happening?
pub date_and_time: DateTime<Utc>, //TODO: Switch from DateTime<Utc> to TimeZones pub date_and_time: DateTime<Utc>,
/// This will be stored as a Decimal in the database but the actual input from the user /// This will be stored as a Decimal in the database but the actual input from the user
/// will not be in rust_decimal::Decimal type. /// will not be in rust_decimal::Decimal type.
pub cost_to_join: Decimal, pub cost_to_join: Decimal,