Skip to main content

update_modules

Function update_modules 

Source
pub async fn update_modules(
    conn: &mut PgConnection,
    course_id: Uuid,
    updates: ModuleUpdates,
    actor_user_id: Uuid,
) -> ModelResult<()>
Expand description

Applies the module editor’s changes to course_id in one transaction, through upsert_from_snapshot, and records the modules and chapters it changed in their history.

Rejects the whole update if any referenced module or chapter is not in the course, or if a module fails upsert_from_snapshot’s checks. actor_user_id is the author of the history rows and of the registrations upsert_from_snapshot cancels.