forked from Ruderverein-Donau-Linz/rowt
		
	fix error w/ clippy
This commit is contained in:
		@@ -68,7 +68,7 @@ async fn index(
 | 
			
		||||
 | 
			
		||||
#[get("/kiosk/ekrv2019")]
 | 
			
		||||
fn new_kiosk(cookies: &CookieJar<'_>) -> Redirect {
 | 
			
		||||
    let mut cookie = Cookie::new("kiosk", format!("yes"));
 | 
			
		||||
    let mut cookie = Cookie::new("kiosk", "yes".to_string());
 | 
			
		||||
    cookie.set_expires(OffsetDateTime::now_utc() + Duration::weeks(12));
 | 
			
		||||
    cookies.add_private(cookie);
 | 
			
		||||
    Redirect::to("/log")
 | 
			
		||||
@@ -121,7 +121,6 @@ async fn create_logbook(db: &SqlitePool, data: Form<LogToAdd>) -> Flash<Redirect
 | 
			
		||||
        Err(LogbookCreateError::TooManyRowers(expected, actual)) => Flash::error(Redirect::to("/log"), format!("Zu viele Ruderer (Boot fasst maximal {expected}, es wurden jedoch {actual} Ruderer ausgewählt)")),
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[post("/", data = "<data>", rank = 2)]
 | 
			
		||||
@@ -134,11 +133,20 @@ async fn create(
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[post("/", data = "<data>")]
 | 
			
		||||
async fn create_kiosk(db: &State<SqlitePool>, data: Form<LogToAdd>, _kiosk: KioskCookie) -> Flash<Redirect> {
 | 
			
		||||
async fn create_kiosk(
 | 
			
		||||
    db: &State<SqlitePool>,
 | 
			
		||||
    data: Form<LogToAdd>,
 | 
			
		||||
    _kiosk: KioskCookie,
 | 
			
		||||
) -> Flash<Redirect> {
 | 
			
		||||
    create_logbook(db, data).await
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async fn home_logbook(db: &SqlitePool, data: Form<LogToFinalize>, logbook_id: i32, user: &User) -> Flash<Redirect>{
 | 
			
		||||
async fn home_logbook(
 | 
			
		||||
    db: &SqlitePool,
 | 
			
		||||
    data: Form<LogToFinalize>,
 | 
			
		||||
    logbook_id: i32,
 | 
			
		||||
    user: &User,
 | 
			
		||||
) -> Flash<Redirect> {
 | 
			
		||||
    let logbook: Option<Logbook> = Logbook::find_by_id(db, logbook_id).await;
 | 
			
		||||
    let Some(logbook) = logbook else {
 | 
			
		||||
            return Flash::error(
 | 
			
		||||
@@ -155,7 +163,6 @@ async fn home_logbook(db: &SqlitePool, data: Form<LogToFinalize>, logbook_id: i3
 | 
			
		||||
            format!("Logbook with ID {} could not be updated!", logbook_id),
 | 
			
		||||
        ),
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[post("/<logbook_id>", data = "<data>")]
 | 
			
		||||
@@ -163,10 +170,18 @@ async fn home_kiosk(
 | 
			
		||||
    db: &State<SqlitePool>,
 | 
			
		||||
    data: Form<LogToFinalize>,
 | 
			
		||||
    logbook_id: i32,
 | 
			
		||||
    _kiosk: KioskCookie
 | 
			
		||||
    _kiosk: KioskCookie,
 | 
			
		||||
) -> Flash<Redirect> {
 | 
			
		||||
    let logbook = Logbook::find_by_id(db, logbook_id).await.unwrap(); //TODO: fixme
 | 
			
		||||
    home_logbook(db, data, logbook_id, &User::find_by_id(db, logbook.shipmaster as i32).await.unwrap()).await
 | 
			
		||||
    home_logbook(
 | 
			
		||||
        db,
 | 
			
		||||
        data,
 | 
			
		||||
        logbook_id,
 | 
			
		||||
        &User::find_by_id(db, logbook.shipmaster as i32)
 | 
			
		||||
            .await
 | 
			
		||||
            .unwrap(),
 | 
			
		||||
    )
 | 
			
		||||
    .await
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[post("/<logbook_id>", data = "<data>", rank = 2)]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user