public static void getJobResultsChart(int jobId, int hours, @As(",") String[] params) { try { List<JobResult> results = JobResult.getByJobId(jobId, hours); String result = "["; int r = 0; for (JobResult jr : results) { if (r++ != 0) result += ","; result += "[" + jr.startTime; for (String param : params) { result += "," + jr.getParam(param); } result += "]"; } result += "]"; renderJSON(result); } catch (Exception e) { badRequest(); } }
public static void getLastResult(int jobId) { JobResult jr = JobResult.getLastResult(jobId); if (jr != null) jr.message = jr.message.replace("\n", "<br/>"); renderJSON(jr); }