Add option to manually swap shifts after the schedule has been generated

This commit is contained in:
2026-07-02 19:15:07 +03:00
parent 515b9aa317
commit 9d8eacfb2b
7 changed files with 550 additions and 31 deletions

View File

@@ -192,6 +192,27 @@ pub enum ShiftPosition {
Second,
}
impl ShiftPosition {
pub fn as_str(self) -> &'static str {
match self {
ShiftPosition::First => "First",
ShiftPosition::Second => "Second",
}
}
}
impl TryFrom<&str> for ShiftPosition {
type Error = ();
fn try_from(s: &str) -> Result<Self, Self::Error> {
match s {
"First" => Ok(ShiftPosition::First),
"Second" => Ok(ShiftPosition::Second),
_ => Err(()),
}
}
}
#[cfg(test)]
mod tests {
use rstest::rstest;