pub async fn schedule_class(class_id: i32, conn: &Database) -> Result<(), SchedulingError> {
    match conn
        .run(move |c| {
            class::table
                .filter(class::id.eq(class_id))
                .inner_join(class_student::table.inner_join(users::table))
                .select(users::id)
                .load::<i32>(c)
        })
        .await
    {
        Ok(users) => {
            for user_id in users {
                two_week_schedule(user_id, conn).await?;
            }
            Ok(())
        }
        Err(e) => Err(SchedulingError::DatabaseError(e)),
    }
}
/// Computes the schedule for all users in a class.
Computes the schedule for all users in a class.
Computes the schedule for all users in a class .
pub async fn schedule_class(class_id: i32, conn: &Database) -> Result<(), SchedulingError> {
    match conn
        .run(move |c| {
            class::table
                .filter(class::id.eq(class_id))
                .inner_join(class_student::table.inner_join(users::table))
                .select(users::id)
                .load::<i32>(c)
        })
        .await
    {
        Ok(users) => {
            for user_id in users {
                two_week_schedule(user_id, conn).await?;
            }
            Ok(())
        }
        Err(e) => Err(SchedulingError::DatabaseError(e)),
    }
}
pub async fn schedule_class ( class_id : i32 , conn : & Database ) -> Result < ( ) , SchedulingError > { match conn . run ( move | c | { class :: table . filter ( class :: id . eq ( class_id ) ) . inner_join ( class_student :: table . inner_join ( users :: table ) ) . select ( users :: id ) . load :: < i32 > ( c ) } ) . await { Ok ( users ) => { for user_id in users { two_week_schedule ( user_id , conn ) . await ? ; } Ok ( ( ) ) } Err ( e ) => Err ( SchedulingError :: DatabaseError ( e ) ) , } }
Computes the schedule for all users in a class.
Computes the schedule for all users in a class .
class_id
i32
conn
&Database