Add option to manually swap shifts after the schedule has been generated
This commit is contained in:
@@ -47,6 +47,29 @@ pub enum ExportError {
|
||||
OpenFailed(String),
|
||||
}
|
||||
|
||||
#[derive(Error, Debug, Serialize)]
|
||||
#[serde(tag = "kind", content = "details")]
|
||||
pub enum SwapError {
|
||||
#[error("no schedule has been generated yet")]
|
||||
NotGenerated,
|
||||
#[error("invalid shift position: {0}")]
|
||||
InvalidPosition(String),
|
||||
#[error("slot has no assigned resident")]
|
||||
SlotEmpty,
|
||||
#[error("both slots belong to the same resident")]
|
||||
SameResident,
|
||||
#[error("resident not found in config")]
|
||||
ResidentNotFound,
|
||||
#[error("resident cannot take the target slot: negative shift or disallowed type")]
|
||||
ResidentCannotTakeSlot,
|
||||
#[error("swap violates same-day or toxic pair constraint")]
|
||||
SameDayOrToxicPair,
|
||||
#[error("swap creates a consecutive-day constraint violation")]
|
||||
ConsecutiveDays,
|
||||
#[error("cannot swap the same slot or slots on the same day")]
|
||||
SameSlotOrDay,
|
||||
}
|
||||
|
||||
impl Serialize for ExportError {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user