diff --git a/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/allocator/AllocatorTask.java b/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/allocator/AllocatorTask.java index fd1b7c574c..024a960e41 100644 --- a/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/allocator/AllocatorTask.java +++ b/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/allocator/AllocatorTask.java @@ -328,12 +328,7 @@ private class ChangeStatus { ChangeStatus(Row row) { nChanges = row.getInt("n_changes"); - Integer errors = row.getInteger("n_errors"); - if (errors == null) { - nErrors = 0; - } else { - nErrors = errors; - } + nErrors = row.getInt("n_errors"); } } diff --git a/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/db/SQLQueries.java b/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/db/SQLQueries.java index 60b4984ddc..e125534943 100644 --- a/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/db/SQLQueries.java +++ b/SpiNNaker-allocserv/src/main/java/uk/ac/manchester/spinnaker/alloc/db/SQLQueries.java @@ -809,8 +809,7 @@ public abstract class SQLQueries { */ @Parameter("change_id") protected static final String ERROR_PENDING = - "UPDATE pending_changes SET is_error=1 " - + "WHERE change_id = :change_id"; + "UPDATE pending_changes SET is_error=1 WHERE change_id = :change_id"; /** * Get descriptions of how to move from a board to its neighbours. @@ -863,7 +862,7 @@ public abstract class SQLQueries { @ResultColumn("n_errors") protected static final String COUNT_CHANGES_FOR_JOB = "SELECT COUNT(change_id) as n_changes, " - + "SUM(is_error) as n_errors " + + "COALESCE(SUM(is_error), 0) as n_errors " + "FROM pending_changes " + "WHERE job_id = :job_id AND from_state = :from_state " + "AND to_state = :to_state";