code: protected StatusDetail toStatusDetail(final List<JobInfo> jobInfos,
                                            final JobDefinition jobDefinition) {
          final Status status;
          final String message;
          final JobInfo currentJob = jobInfos.get(0);
          final JobInfo lastJob = (!currentJob.getStopped().isPresent() && currentJob.getStatus() == JobStatus.OK && jobInfos.size() > 1) ? jobInfos.get(1) : jobInfos.get(0);
          final JobMeta jobMeta = getJobMeta(jobDefinition.jobType());
          long numFailedJobs = getNumFailedJobs(jobInfos);
          if (!jobMeta.isDisabled()) {
              switch (lastJob.getStatus()) {
                  case OK:
                  case SKIPPED:
                      if (jobTooOld(lastJob, jobDefinition)) {
                          status = WARNING;
                          message = jobAgeMessage(jobDefinition);
                      } else if (numFailedJobs > maxFailedJobs) {
                          status = WARNING;
                          message = format(TOO_MANY_JOBS_FAILED_MESSAGE, numFailedJobs, jobInfos.size());
                      } else {
                          status = OK;
                          message = SUCCESS_MESSAGE;
                      }
                      break;
                  case ERROR:
                      if (numFailedJobs > maxFailedJobs) {
                          status = ERROR;
                      } else {
                          status = WARNING;
                      }
                      if (numberOfJobs == 1 && maxFailedJobs <= 1) {
                          message = ERROR_MESSAGE;
                      } else {
                          message = format(TOO_MANY_JOBS_FAILED_MESSAGE, numFailedJobs, jobInfos.size());
                      }
                      break;
  
                  case DEAD:
                  default:
                      status = WARNING;
                      message = DEAD_MESSAGE;
              }
          } else {
              status = OK;
              message = format(JOB_DEACTIVATED_MESSAGE, jobMeta.getDisabledComment());
          }
          return StatusDetail.statusDetail(
                  jobDefinition.jobName(),
                  status,
                  message,
                  asList(
                          link(REL_JOB, String.format("%s/jobs/%s", managementContextPath, lastJob.getJobId()), "Details")
                  ),
                  runningDetailsFor(lastJob)
          );
      }
docs: Calculates the StatusDetail from the last job executions.
  
  @param jobInfos      one or more JobInfo
  @param jobDefinition definition of the last job
  @return StatusDetail to indicate for the given last job