pub async fn html_view_all_async_tasks_in_class(
    class_id: i32,
    auth: AuthCookie,
    conn: Database,
) -> Html {
    if let Some(role) = get_user_role_in_class(auth.0, class_id, &conn).await {
        match role {
            crate::class::ClassMemberRole::Teacher => {
                match get_teacher_async_tasks_summary(class_id, auth.0, &conn).await {
                    Ok((tasks, completion_count, student_count)) => {
                        render_teacher_async_tasks(tasks, completion_count, student_count)
                    }
                    Err(e) => match e {
                        ShowAsyncTaskSummaryError::DatabaseError => database_error(),
                    },
                }
            }
            crate::class::ClassMemberRole::Student => {
                let res = match get_student_async_tasks_summary(class_id, auth.0, &conn).await {
                    Ok(res) => res,
                    Err(e) => match e {
                        ShowAsyncTaskSummaryError::DatabaseError => return database_error(),
                    },
                };
                render_student_task_summary(res)
            }
        }
    } else {
        permission_error()
    }
}
/// Show a list of all the asynchronous tasks have been set in a class, either to a teacher or a
/// student (this is retrieved from the database).
Show a list of all the asynchronous tasks have been set in a class, either to a teacher or a
student (this is retrieved from the database).
Show a list of all the asynchronous tasks have been set in a class either to a teacher or a student ( this is retrieved from the database ) .
pub async fn html_view_all_async_tasks_in_class(
    class_id: i32,
    auth: AuthCookie,
    conn: Database,
) -> Html {
    if let Some(role) = get_user_role_in_class(auth.0, class_id, &conn).await {
        match role {
            crate::class::ClassMemberRole::Teacher => {
                match get_teacher_async_tasks_summary(class_id, auth.0, &conn).await {
                    Ok((tasks, completion_count, student_count)) => {
                        render_teacher_async_tasks(tasks, completion_count, student_count)
                    }
                    Err(e) => match e {
                        ShowAsyncTaskSummaryError::DatabaseError => database_error(),
                    },
                }
            }
            crate::class::ClassMemberRole::Student => {
                let res = match get_student_async_tasks_summary(class_id, auth.0, &conn).await {
                    Ok(res) => res,
                    Err(e) => match e {
                        ShowAsyncTaskSummaryError::DatabaseError => return database_error(),
                    },
                };
                render_student_task_summary(res)
            }
        }
    } else {
        permission_error()
    }
}
pub async fn html_view_all_async_tasks_in_class ( class_id : i32 , auth : AuthCookie , conn : Database , ) -> Html { if let Some ( role ) = get_user_role_in_class ( auth . 0 , class_id , & conn ) . await { match role { crate :: class :: ClassMemberRole :: Teacher => { match get_teacher_async_tasks_summary ( class_id , auth . 0 , & conn ) . await { Ok ( ( tasks , completion_count , student_count ) ) => { render_teacher_async_tasks ( tasks , completion_count , student_count ) } Err ( e ) => match e { ShowAsyncTaskSummaryError :: DatabaseError => database_error ( ) , } , } } crate :: class :: ClassMemberRole :: Student => { let res = match get_student_async_tasks_summary ( class_id , auth . 0 , & conn ) . await { Ok ( res ) => res , Err ( e ) => match e { ShowAsyncTaskSummaryError :: DatabaseError => return database_error ( ) , } , } ; render_student_task_summary ( res ) } } } else { permission_error ( ) } }
Show a list of all the asynchronous tasks have been set in a class, either to a teacher or a
student (this is retrieved from the database).
Show a list of all the asynchronous tasks have been set in a class either to a teacher or a student ( this is retrieved from the database ) .
class_id
i32
auth
AuthCookie
conn
Database