Automatically delete members when families are deleted

This commit is contained in:
2023-08-04 19:17:51 +02:00
parent f344765dd8
commit 8f5131429f
6 changed files with 34 additions and 9 deletions

View File

@ -130,7 +130,7 @@ pub enum Sex {
}
impl Sex {
pub fn from_str(s: &str) -> Option<Self> {
pub fn parse_str(s: &str) -> Option<Self> {
match s {
"M" => Some(Sex::Male),
"F" => Some(Sex::Female),
@ -184,10 +184,7 @@ impl Member {
}
pub fn sex(&self) -> Option<Sex> {
self.sex
.as_deref()
.map(|s| Sex::from_str(s))
.unwrap_or_default()
self.sex.as_deref().map(Sex::parse_str).unwrap_or_default()
}
pub fn set_sex(&mut self, s: Option<Sex>) {