Skip to content

Commit 0bb6f3a

Browse files
authored
fix "deletion already in-progress" bug (#1156)
1 parent b05b4ec commit 0bb6f3a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

app/org/maproulette/controllers/api/ChallengeController.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,15 @@ class ChallengeController @Inject() (
643643
try {
644644
this.dal.deleteTasks(user, challengeId, Utils.split(statusFilters).map(_.toInt))
645645
} finally {
646-
dalManager.challenge.update(Json.obj("status" -> originalStatus), user)(challengeId)
646+
// Check if original status is defined before reverting
647+
originalStatus match {
648+
case Some(status) =>
649+
dalManager.challenge.update(Json.obj("status" -> status), user)(challengeId)
650+
case None =>
651+
throw new InvalidException(
652+
"Original status is not defined, cannot revert status."
653+
)
654+
}
647655
}
648656
}
649657
Ok

0 commit comments

Comments
 (0)