Fix job count for the different status. reduce duplicated code

Status "notbuilt" is now counted as disabled.
Status "yellow"/"unstable" is now counted as failed.
Exchanged ternary operator with function.