forked from Ruderverein-Donau-Linz/rowt
		
	Merge commit '95e1ea302884fa1214950b6c4005525f7469ac58' into ergo-styling
This commit is contained in:
		@@ -124,7 +124,7 @@ pub enum LogbookCreateError {
 | 
			
		||||
 | 
			
		||||
impl From<LogbookUpdateError> for LogbookCreateError {
 | 
			
		||||
    fn from(value: LogbookUpdateError) -> Self {
 | 
			
		||||
        return match value {
 | 
			
		||||
        match value {
 | 
			
		||||
            LogbookUpdateError::NotYourEntry => LogbookCreateError::NotYourEntry,
 | 
			
		||||
            LogbookUpdateError::TooManyRowers(a, b) => LogbookCreateError::TooManyRowers(a, b),
 | 
			
		||||
            LogbookUpdateError::RowerCreateError(a, b) => {
 | 
			
		||||
@@ -140,7 +140,7 @@ impl From<LogbookUpdateError> for LogbookCreateError {
 | 
			
		||||
            LogbookUpdateError::UserNotAllowedToUseBoat => {
 | 
			
		||||
                LogbookCreateError::UserNotAllowedToUseBoat
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -429,7 +429,7 @@ ORDER BY departure DESC
 | 
			
		||||
            return Err(LogbookUpdateError::SteeringPersonNotInRowers);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if !boat.shipmaster_allowed(&user).await && self.shipmaster != user.id {
 | 
			
		||||
        if !boat.shipmaster_allowed(user).await && self.shipmaster != user.id {
 | 
			
		||||
            //second part:
 | 
			
		||||
            //shipmaster has
 | 
			
		||||
            //entered a
 | 
			
		||||
 
 | 
			
		||||
@@ -67,11 +67,7 @@ async fn reset(db: &State<SqlitePool>, _user: AdminUser) -> Flash<Redirect> {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[get("/")]
 | 
			
		||||
async fn index(
 | 
			
		||||
    db: &State<SqlitePool>,
 | 
			
		||||
    user: NonGuestUser,
 | 
			
		||||
    flash: Option<FlashMessage<'_>>,
 | 
			
		||||
) -> Template {
 | 
			
		||||
async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_>>) -> Template {
 | 
			
		||||
    let users = User::ergo(db).await;
 | 
			
		||||
 | 
			
		||||
    let thirty = sqlx::query_as!(
 | 
			
		||||
@@ -94,7 +90,7 @@ async fn index(
 | 
			
		||||
    if let Some(msg) = flash {
 | 
			
		||||
        context.insert("flash", &msg.into_inner());
 | 
			
		||||
    }
 | 
			
		||||
    context.insert("loggedin_user", &user.user);
 | 
			
		||||
    context.insert("loggedin_user", &user);
 | 
			
		||||
    context.insert("users", &users);
 | 
			
		||||
    context.insert("thirty", &thirty);
 | 
			
		||||
    context.insert("dozen", &dozen);
 | 
			
		||||
@@ -113,7 +109,7 @@ pub struct ErgoToAdd<'a> {
 | 
			
		||||
async fn new_thirty(
 | 
			
		||||
    db: &State<SqlitePool>,
 | 
			
		||||
    mut data: Form<ErgoToAdd<'_>>,
 | 
			
		||||
    created_by: NonGuestUser,
 | 
			
		||||
    created_by: User,
 | 
			
		||||
) -> Flash<Redirect> {
 | 
			
		||||
    let user = User::find_by_id(db, data.user as i32).await.unwrap();
 | 
			
		||||
 | 
			
		||||
@@ -139,10 +135,7 @@ async fn new_thirty(
 | 
			
		||||
 | 
			
		||||
    Log::create(
 | 
			
		||||
        db,
 | 
			
		||||
        format!(
 | 
			
		||||
            "{} created thirty-ergo entry: {data:?}",
 | 
			
		||||
            created_by.user.name
 | 
			
		||||
        ),
 | 
			
		||||
        format!("{} created thirty-ergo entry: {data:?}", created_by.name),
 | 
			
		||||
    )
 | 
			
		||||
    .await;
 | 
			
		||||
 | 
			
		||||
@@ -153,7 +146,7 @@ async fn new_thirty(
 | 
			
		||||
async fn new_dozen(
 | 
			
		||||
    db: &State<SqlitePool>,
 | 
			
		||||
    mut data: Form<ErgoToAdd<'_>>,
 | 
			
		||||
    created_by: NonGuestUser,
 | 
			
		||||
    created_by: User,
 | 
			
		||||
) -> Flash<Redirect> {
 | 
			
		||||
    let user = User::find_by_id(db, data.user as i32).await.unwrap();
 | 
			
		||||
 | 
			
		||||
@@ -179,10 +172,7 @@ async fn new_dozen(
 | 
			
		||||
 | 
			
		||||
    Log::create(
 | 
			
		||||
        db,
 | 
			
		||||
        format!(
 | 
			
		||||
            "{} created dozen-ergo entry: {data:?}",
 | 
			
		||||
            created_by.user.name
 | 
			
		||||
        ),
 | 
			
		||||
        format!("{} created dozen-ergo entry: {data:?}", created_by.name),
 | 
			
		||||
    )
 | 
			
		||||
    .await;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -217,12 +217,10 @@ async fn create_kiosk(
 | 
			
		||||
        User::find_by_id(db, boat.owner.unwrap() as i32)
 | 
			
		||||
            .await
 | 
			
		||||
            .unwrap()
 | 
			
		||||
    } else if let Some(shipmaster) = data.shipmaster {
 | 
			
		||||
        User::find_by_id(db, shipmaster as i32).await.unwrap()
 | 
			
		||||
    } else {
 | 
			
		||||
        if let Some(shipmaster) = data.shipmaster {
 | 
			
		||||
            User::find_by_id(db, shipmaster as i32).await.unwrap()
 | 
			
		||||
        } else {
 | 
			
		||||
            User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
 | 
			
		||||
        }
 | 
			
		||||
        User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
 | 
			
		||||
    };
 | 
			
		||||
    Log::create(
 | 
			
		||||
        db,
 | 
			
		||||
 
 | 
			
		||||
@@ -101,6 +101,12 @@
 | 
			
		||||
            </a>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
	{% else %}
 | 
			
		||||
	    {% if loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
 | 
			
		||||
            <a href="/ergo">
 | 
			
		||||
              Ergo
 | 
			
		||||
            </a>
 | 
			
		||||
	    {% endif %}
 | 
			
		||||
        {% endif %} {% if loggedin_user.is_admin %}
 | 
			
		||||
        <a
 | 
			
		||||
          href="/admin/user"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user