static function inbetweenBuilds($regression) { $build = $regression->build(); $run = $build->run(); $mode_id = $build->mode_id(); $machine_id = $run->machine_id(); $sortOrder = $run->sort_order(); $prevSortOrder = $regression->prev_build()->run()->sort_order(); $builds = array(); for ($i = $prevSortOrder + 1; $i < $sortOrder; $i++) { $run_i = Run::withMachineAndSortOrder($machine_id, $i); if (!$run_i->isFinished()) { continue; } $build = Build::withRunAndMode($run_i->id, $mode_id); if (!$build) { continue; } if (count($build->scores()) == 0) { continue; } $builds[] = $build; } return $builds; }
private static function assertInBound($run_before, $run_after, $mode_id, $sort_order) { if ($sort_order <= $run_before->sort_order()) { throw new Exception("bound is lower."); } if ($sort_order > $run_after->sort_order()) { // It is allowed to have a not in bound $sort_order, // when the revision stays the same between $run_after and the $sort_order. $current_run = Run::withMachineAndSortOrder($run_after->machine_id(), $sort_order)->prev(); $current_build = Build::withRunAndMode($current_run->id, $mode_id); $after_build = Build::withRunAndMode($run_after->id, $mode_id); if ($current_build->revision() != $after_build->revision()) { throw new Exception("bound is higher."); } } }