Fetching all runs only if neccesary

This commit is contained in:
Jeroen De Meerleer 2018-08-31 11:16:14 +02:00
parent 17072dee45
commit 890c392bcf
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
1 changed files with 5 additions and 1 deletions

View File

@ -35,7 +35,11 @@ if ($jobnameResult[0]["user"] != $_SESSION["userID"]) {
}
$jobName = $jobnameResult[0]['name'];
$runsForJob = $db->prepare("SELECT runs.*, jobs.name FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?");
$runsForJobQry = "SELECT runs.*, jobs.name FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?";
if(!isset($_GET['allruns']) || $_GET['allruns'] == 1) {
$runsForJobQry .= " AND runs.statuscode = jobs.expected";
}
$runsForJob = $db->prepare($runsForJobQry);
$runsForJob->execute(array($_GET['jobID']));
$runsForJobResult = $runsForJob->fetchAll(PDO::FETCH_ASSOC);