Merge pull request 'fix empty but non-null date entries' (#630) from halfprice-fee into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m11s
CI/CD Pipeline / deploy-staging (push) Successful in 6m21s
CI/CD Pipeline / deploy-main (push) Has been skipped

Reviewed-on: #630
This commit is contained in:
philipp 2024-07-22 21:57:30 +02:00
commit 8112f1ed2a

View File

@ -362,10 +362,14 @@ ASKÖ Ruderverein Donau Linz", self.name),
}
let halfprice = if let Some(member_since_date) = &self.member_since_date {
let member_since_date =
NaiveDate::parse_from_str(member_since_date, "%Y-%m-%d").unwrap();
let halfprice_startdate = NaiveDate::from_ymd_opt(Local::now().year(), 7, 1).unwrap();
member_since_date >= halfprice_startdate
if let Ok(member_since_date) = NaiveDate::parse_from_str(member_since_date, "%Y-%m-%d")
{
let halfprice_startdate =
NaiveDate::from_ymd_opt(Local::now().year(), 7, 1).unwrap();
member_since_date >= halfprice_startdate
} else {
false
}
} else {
false
};