Compare commits

..

No commits in common. "cdd57eb147223d9df7513eb14755f300d4e1bd96" and "4a0026a9ee0c54597ba6957300fef0f4eb471858" have entirely different histories.

6 changed files with 9 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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

View File

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