Add missing shift type check
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
use chrono::{Datelike, NaiveDate, Weekday};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::schedule::ShiftType;
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, PartialOrd, Ord, Eq, Debug, Hash, Clone, Copy)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Slot {
|
||||
@@ -88,6 +90,14 @@ impl Slot {
|
||||
position: other_pos,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn shift_type(&self) -> ShiftType {
|
||||
match (self.is_open_shift(), self.position) {
|
||||
(true, ShiftPosition::First) => ShiftType::OpenFirst,
|
||||
(true, ShiftPosition::Second) => ShiftType::OpenSecond,
|
||||
(false, _) => ShiftType::Closed,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Slot {
|
||||
|
||||
Reference in New Issue
Block a user