Compare commits

...

2 Commits

Author SHA1 Message Date
cdd57eb147 Merge pull request 'code cleanup' (#214) from staging into main
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
Reviewed-on: #214
2024-02-21 14:47:54 +01:00
6ed28994c6 code cleanup
Some checks failed
CI/CD Pipeline / test (push) Failing after 15m23s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-02-21 14:46:17 +01:00
6 changed files with 11 additions and 9 deletions

View File

@ -1,3 +1,5 @@
#![allow(clippy::blocks_in_conditions)]
pub mod model;
#[cfg(feature = "rowing-tera")]

View File

@ -1,3 +1,5 @@
#![allow(clippy::blocks_in_conditions)]
use std::str::FromStr;
#[cfg(feature = "rest")]

View File

@ -22,7 +22,7 @@ impl Family {
.unwrap()
}
pub async fn new(db: &SqlitePool) -> i64 {
pub async fn insert(db: &SqlitePool) -> i64 {
let result: SqliteQueryResult = sqlx::query("INSERT INTO family DEFAULT VALUES")
.execute(db)
.await

View File

@ -96,7 +96,7 @@ impl Mail {
}
None => {
if let Some(mail) = &user.mail {
send_to.push_str(&mail)
send_to.push_str(mail)
}
}
}

View File

@ -128,7 +128,7 @@ impl Fee {
pub fn add_person(&mut self, user: &User) {
if !self.name.is_empty() {
self.name.push_str(" + ");
self.user_ids.push_str("&");
self.user_ids.push('&');
}
self.name.push_str(&user.name);
@ -171,7 +171,7 @@ impl User {
fee.add("Familie 2 Personen".into(), FAMILY_TWO);
}
} else {
fee.add_person(&self);
fee.add_person(self);
if self.has_role(db, "paid").await {
fee.paid();
}
@ -440,7 +440,7 @@ ORDER BY last_access DESC
let mut family_id = data.family_id;
if family_id.is_some_and(|x| x == -1) {
family_id = Some(Family::new(db).await)
family_id = Some(Family::insert(db).await)
}
sqlx::query!(
@ -779,9 +779,7 @@ impl<'r> FromRequest<'r> for AllowedForPlannedTripsUser {
let db = req.rocket().state::<SqlitePool>().unwrap();
match User::from_request(req).await {
Outcome::Success(user) => {
if user.has_role(db, "Donau Linz").await {
Outcome::Success(AllowedForPlannedTripsUser(user))
} else if user.has_role(db, "scheckbuch").await {
if user.has_role(db, "Donau Linz").await | user.has_role(db, "scheckbuch").await {
Outcome::Success(AllowedForPlannedTripsUser(user))
} else {
Outcome::Error((Status::Forbidden, LoginError::NotACox))

View File

@ -171,7 +171,7 @@ async fn create_logbook(
match Logbook::create(
db,
data.into_inner(),
&user
user
)
.await
{