treat empty membership pdf as non-existing
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m3s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
philipp 2024-04-29 21:10:34 +02:00
parent 18047d16bf
commit 139acb2ec5

View File

@ -989,12 +989,16 @@ pub struct UserWithRolesAndMembershipPdf {
impl UserWithRolesAndMembershipPdf { impl UserWithRolesAndMembershipPdf {
pub(crate) async fn from_user(db: &SqlitePool, user: User) -> Self { pub(crate) async fn from_user(db: &SqlitePool, user: User) -> Self {
let membership_pdf: bool = let membership_pdf =
sqlx::query_scalar!("SELECT membership_pdf FROM user WHERE id = ?", user.id) match sqlx::query_scalar!("SELECT membership_pdf FROM user WHERE id = ?", user.id)
.fetch_one(db) .fetch_one(db)
.await .await
.unwrap() .unwrap()
.is_some(); {
Some(a) if a.is_empty() => false,
None => false,
_ => true,
};
Self { Self {
roles: user.roles(db).await, roles: user.roles(db).await,