pub async fn update_training(ctx: &Context, training_id: i32) -> Result<Option<Message>> {
        let mut training = db::Training::by_id(ctx, training_id).await?;
        // only accept correct state
        let ret = match training.state {
            db::TrainingState::Open | db::TrainingState::Closed | db::TrainingState::Started => {
                let msg = Self::post_training(ctx, &mut training).await?;
                Ok(Some(msg))
            }
            _ => {
                let _msg = Self::delete_training(ctx, &training).await?;
                Ok(None)
            }
        };
        SignupBoard::get(ctx)
            .await
            .read()
            .await
            .update_overview(ctx)
            .await?;
        ret
    }
// This updates or inserts a training to the signup board
// Try to avoid calling this too often since it does a lot of networking
// This function also updates the overview message while post and delete dont
This updates or inserts a training to the signup board
Try to avoid calling this too often since it does a lot of networking
This function also updates the overview message while post and delete dont
This updates or inserts a training to the signup board Try to avoid calling this too often since it does a lot of networking This function also updates the overview message while post and delete dont
pub async fn update_training(ctx: &Context, training_id: i32) -> Result<Option<Message>> {
        let mut training = db::Training::by_id(ctx, training_id).await?;
        // only accept correct state
        let ret = match training.state {
            db::TrainingState::Open | db::TrainingState::Closed | db::TrainingState::Started => {
                let msg = Self::post_training(ctx, &mut training).await?;
                Ok(Some(msg))
            }
            _ => {
                let _msg = Self::delete_training(ctx, &training).await?;
                Ok(None)
            }
        };
        SignupBoard::get(ctx)
            .await
            .read()
            .await
            .update_overview(ctx)
            .await?;
        ret
    }
pub async fn update_training ( ctx : & Context , training_id : i32 ) -> Result < Option < Message > > { let mut training = db :: Training :: by_id ( ctx , training_id ) . await ? ; // only accept correct state let ret = match training . state { db :: TrainingState :: Open | db :: TrainingState :: Closed | db :: TrainingState :: Started => { let msg = Self :: post_training ( ctx , & mut training ) . await ? ; Ok ( Some ( msg ) ) } _ => { let _msg = Self :: delete_training ( ctx , & training ) . await ? ; Ok ( None ) } } ; SignupBoard :: get ( ctx ) . await . read ( ) . await . update_overview ( ctx ) . await ? ; ret }
This updates or inserts a training to the signup board
Try to avoid calling this too often since it does a lot of networking
This function also updates the overview message while post and delete dont
This updates or inserts a training to the signup board Try to avoid calling this too often since it does a lot of networking This function also updates the overview message while post and delete dont
ctx
&Context
training_id
i32