diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/scheduling/JobConfiguration.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/scheduling/JobConfiguration.java index 842c0b13a2f0..7eca33034291 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/scheduling/JobConfiguration.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/scheduling/JobConfiguration.java @@ -341,7 +341,10 @@ public boolean isUsedInQueue() { } public boolean isRunOnce() { - return cronExpression == null && delay == null && queueName == null; + return schedulingType == SchedulingType.ONCE_ASAP + && cronExpression == null + && delay == null + && queueName == null; } public boolean isDueBetween( diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/JobSchedulerControllerTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/JobSchedulerControllerTest.java index 047e63de8dee..959825d015c5 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/JobSchedulerControllerTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/JobSchedulerControllerTest.java @@ -307,6 +307,9 @@ void testDeleteQueue() { assertStatus(HttpStatus.NO_CONTENT, DELETE("/scheduler/queues/testQueue")); assertStatus(HttpStatus.NOT_FOUND, GET("/scheduler/queues/testQueue")); + // verify the ex-queue jobs show in the scheduler main list again + JsonArray list = GET("/scheduler").content(); + assertEquals(3, list.size()); } @Test