Skip to main content

plan_revert

Function plan_revert 

Source
pub async fn plan_revert(
    conn: &mut PgConnection,
    view: &CourseView,
    call_id: Uuid,
    user_id: Uuid,
) -> ModelResult<RevertPlan>
Expand description

Works out how to revert one of the user’s agent write calls in the course: every entity it touched goes back to its state just before the call. The revert is a new change staged in the user’s open changeset, so it goes through the normal risk rules and publishing.

The current state is the user’s staged state in view, which must hold every part of the course. If any entity’s current state is not what the call left behind, the plan lists those entities instead. Errors with NotFound if the call is not the user’s or not in the course.