diff --git a/e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ActivityDeletionGoal.java b/e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ActivityDeletionGoal.java index 9c4f12a315..82f3b029a1 100644 --- a/e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ActivityDeletionGoal.java +++ b/e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ActivityDeletionGoal.java @@ -39,6 +39,8 @@ public void run(@NotNull final EditablePlan plan) { Map.of("biteSize", SerializedValue.of(2)) ); + plan.commit(); + if (whichToDelete >= 0) { plan.delete(ids[whichToDelete], anchorStrategy); } diff --git a/procedural/scheduling/src/main/kotlin/gov/nasa/ammos/aerie/procedural/scheduling/utils/DefaultEditablePlanDriver.kt b/procedural/scheduling/src/main/kotlin/gov/nasa/ammos/aerie/procedural/scheduling/utils/DefaultEditablePlanDriver.kt index e8bf893aed..bb56862deb 100644 --- a/procedural/scheduling/src/main/kotlin/gov/nasa/ammos/aerie/procedural/scheduling/utils/DefaultEditablePlanDriver.kt +++ b/procedural/scheduling/src/main/kotlin/gov/nasa/ammos/aerie/procedural/scheduling/utils/DefaultEditablePlanDriver.kt @@ -291,7 +291,7 @@ class DefaultEditablePlanDriver( val result = uncommittedChanges uncommittedChanges = mutableListOf() - for (edit in result) { + for (edit in result.reversed()) { when (edit) { is Edit.Create -> adapter.delete(edit.directive.id) is Edit.Delete -> adapter.create(edit.directive)