diff --git a/runs.php b/runs.php index e06ee90..d73da89 100644 --- a/runs.php +++ b/runs.php @@ -36,8 +36,10 @@ if ($jobnameResult[0]["user"] != $_SESSION["userID"]) { $jobName = $jobnameResult[0]['name']; $runsForJobQry = "SELECT runs.*, jobs.name FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?"; +$allruns = true; if(!isset($_GET['allruns']) || $_GET['allruns'] == 1) { $runsForJobQry .= " AND runs.statuscode = jobs.expected"; + $allruns = false; } $runsForJob = $db->prepare($runsForJobQry); $runsForJob->execute(array($_GET['jobID'])); @@ -59,7 +61,7 @@ foreach($runsForJobResult as $key=>$value) { $count++; } -$twig_vars = array('runs' => $runsForJobRendered, "title" => $jobName); +$twig_vars = array('jobID' => $_GET['jobID'], 'runs' => $runsForJobRendered, 'allruns' => $allruns, "title" => $jobName); //echo $twig->render('overview.html.twig', array('the' => 'variables', 'go' => 'here')); echo $twig->render('runs.html.twig', $twig_vars); diff --git a/templates/runs.html.twig b/templates/runs.html.twig index 445e434..47b85a1 100644 --- a/templates/runs.html.twig +++ b/templates/runs.html.twig @@ -2,6 +2,11 @@ {% block title %}Overview of run for {{ title }}{% endblock %} {% block content %}

Overview of runs for {{ title }}

+{% if allruns %} +

Only show failed runs

+{% elseif not allruns %} +

Only all failed runs

+{% endif %}
{% for run in runs %}