Compare commits

...

2 Commits

Author SHA1 Message Date
79976b751f Merge pull request 'treat empty membership pdf as non-existing' (#456) from treat-empty-membershippdf-as-nonexisting into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 8m29s
CI/CD Pipeline / deploy-staging (push) Successful in 6m6s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #456
2024-04-29 21:33:44 +02:00
139acb2ec5 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
2024-04-29 21:10:34 +02:00

View File

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